annotate WebServiceToolWorkflow/lib/SAWADLParser/src/edu/uga/cs/lsdis/meteors/wadls/GrammarsImpl.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 2001, 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;
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.net.URISyntaxException;
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.ArrayList;
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.Iterator;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
10 import java.util.List;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
11 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
12 import java.util.Vector;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
13
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.Application;
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.ModelReference;
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.Grammars;
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.WADLSException;
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.extensions.schema.Schema;
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.xml.namespace.QName;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
21
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
22 import org.w3c.dom.Attr;
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 import edu.uga.cs.lsdis.meteors.wadls.util.SchemaUtils;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
26
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
27 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
28 * This class represents the <types> section of a WSDL document.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
29 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
30 * @author Zixin Wu (wuzixin@uga.edu)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
31 * @author Matthew J. Duftler (duftler@us.ibm.com)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
32 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
33 public class GrammarsImpl implements Grammars
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 protected Application app = null; //WADLS Definition
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
36 protected List<ModelReference> modelReferences = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
37 protected Element docEl = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
38 protected List extElements = new Vector();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
39 protected Map allSchemas = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
40
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 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
43
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
44 public GrammarsImpl(Application app){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
45 this.app = app;
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
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
48 public List getTopLevelSchemas(){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
49 return SchemaUtils.getSchemas(this.extElements);
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 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
53 * Get the DOM elements of all the schemas in this Types.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
54 * @return A list of DOM elements of all the schemas in this Types.
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 public Map getSchemas(){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
57 return this.allSchemas;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
58 }
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 public void setSchemas(Map allSchemas){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
61 this.allSchemas = allSchemas;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
62 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
63
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
64
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
65 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
66 * Get the DOM element of the first schema in this Types.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
67 * @return The DOM element of the first schema in this Types.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
68 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
69 public Schema getFirstSchema(){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
70 return SchemaUtils.getFirstSchema(this.extElements);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
71 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
72 public ModelReference getModelReference(){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
73 if(modelReferences == null)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
74 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
75 return modelReferences.get(0);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
76 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
77
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
78 public List<ModelReference> getModelReferences(Element startElement, String path, Application app) throws WADLSException, URISyntaxException {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
79 Element el = getXSDEle(startElement, path);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
80 if (el == null)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
81 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
82 String attrModelReference = el.getAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_MODELREF);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
83 if (attrModelReference.equals(""))
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
84 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
85 List<ModelReference> mrefs = ModelReferenceImpl.getModelReferences(attrModelReference, app);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
86 if(mrefs.size() == 0)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
87 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
88 return mrefs;
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 public ModelReference getModelReference(Element startElement, String path, Application app) throws WADLSException, URISyntaxException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
91 List<ModelReference> mrefs = getModelReferences(startElement, path, app);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
92 return mrefs.get(0);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
93 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
94
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
95
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
96 private Element getXSDEle(Element startElement, String path) throws WADLSException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
97 if (path == null || path == "")
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
98 return startElement;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
99 String eleName = startElement.getLocalName();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
100 if (eleName.equals("element")){ //search the target from <element ...
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
101 return SchemaUtils.findXSDEleOnEle(startElement, path, this);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
102 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
103 else if (eleName.equals("complexType")){ //search the target from <complexType ...
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
104 return SchemaUtils.findXSDEleOnComplexType(startElement, path, this);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
105 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
106 else{ //error
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
107 WADLSException wsdlsExc = new WADLSException(WADLSException.PATH_ERROR,
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
108 "simpleType cannot has path");
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
109 throw wsdlsExc;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
110 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
111 }
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
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 * Get all the extensibility elements defined here.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
117 */
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 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
120 * Set the modelReference.
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 * @param modelReference The desired modelReference.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
123 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
124 public void addModelReference(ModelReference modelReference){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
125 if(modelReferences == null)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
126 modelReferences = new ArrayList<ModelReference>();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
127 modelReferences.add(0, modelReference);
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
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
130 public List<ModelReference> getModelReferences() {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
131 return modelReferences;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
132 }
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 public void setModelReferences(List<ModelReference> refs) {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
135 modelReferences = refs;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
136 }
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 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
139 * Set the documentation element for this document. This dependency
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
140 * on org.w3c.dom.Element should eventually be removed when a more
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
141 * appropriate way of representing this information is employed.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
142 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
143 * @param docEl the documentation element
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 public void setDocumentationElement(Element docEl)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
146 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
147 this.docEl = docEl;
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
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
150 public void setModelReferences(Element startElement, String path, List<ModelReference> refs) throws WADLSException {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
151 for(ModelReference ref : refs) {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
152 addModelReference(startElement, path, ref);
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 }
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 public void addModelReference(Element startElement, String path, ModelReference modelReference) throws WADLSException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
157 Element el = getXSDEle(startElement, path);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
158
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
159 if (modelReference != null){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
160 String strModelReference = modelReference.value();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
161 Attr attr = el.getAttributeNodeNS(
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
162 Constants.NS_URI_WADLS, Constants.ATTR_MODELREF);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
163 if(attr == null) {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
164 attr = el.getOwnerDocument().createAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_MODELREF);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
165 attr.setPrefix(Constants.PREFIX_WSDLS);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
166 el.setAttributeNodeNS(attr);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
167 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
168 String value = attr.getValue();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
169 if(value != null) {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
170 value += " " + strModelReference;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
171 } else {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
172 value = strModelReference;
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 attr.setValue(value);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
175 modelReference.setParent(el);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
176 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
177 else
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
178 el.removeAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_MODELREF);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
179 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
180
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 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
183 * Get the documentation element. This dependency on 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
184 * should eventually be removed when a more appropriate way of
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
185 * representing this information is employed.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
186 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
187 * @return the documentation element
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 public Element getDocumentationElement()
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 return docEl;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
192 }
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 public void setLoweringSchemaMapping(Element startElement, String path, String schemaMapping) throws WADLSException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
195 Element el = getXSDEle(startElement, path);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
196 if (schemaMapping != null){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
197 Attr attr = el.getOwnerDocument().createAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_LOWERINGSCHEMAMAPPING);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
198 attr.setPrefix(Constants.PREFIX_WSDLS);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
199 attr.setValue(schemaMapping);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
200 el.setAttributeNodeNS(attr);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
201 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
202 else
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
203 el.removeAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_LOWERINGSCHEMAMAPPING);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
204 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
205
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
206 public void setLiftingSchemaMapping(Element startElement, String path, String schemaMapping) throws WADLSException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
207 Element el = getXSDEle(startElement, path);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
208 if (schemaMapping != null){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
209 Attr attr = el.getOwnerDocument().createAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_LIFTINGSCHEMAMAPPING);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
210 attr.setPrefix(Constants.PREFIX_WSDLS);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
211 attr.setValue(schemaMapping);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
212 el.setAttributeNodeNS(attr);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
213 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
214 else
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
215 el.removeAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_LIFTINGSCHEMAMAPPING);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
216 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
217 public String getLoweringSchemaMapping(Element startElement, String path) throws WADLSException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
218 Element el = getXSDEle(startElement, path);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
219 if (el == null)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
220 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
221 String attrSchemaMapping = el.getAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_LOWERINGSCHEMAMAPPING);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
222 if (attrSchemaMapping == "")
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
223 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
224 return attrSchemaMapping;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
225
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
226 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
227
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
228 public String getLiftingSchemaMapping(Element startElement, String path) throws WADLSException{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
229 Element el = getXSDEle(startElement, path);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
230 if (el == null)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
231 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
232 String attrSchemaMapping = el.getAttributeNS(Constants.NS_URI_WADLS, Constants.ATTR_LIFTINGSCHEMAMAPPING);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
233 if (attrSchemaMapping == "")
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
234 return null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
235 return attrSchemaMapping;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
236
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
237 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
238
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
239
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
240 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
241 * Add an extensibility element.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
242 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
243 * @param extElement the extensibility element to be added
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
244 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
245
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
246
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
247 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
248 * Get all the extensibility elements defined here.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
249 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
250
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
251
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
252 public String toString()
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
253 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
254 StringBuffer strBuf = new StringBuffer();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
255
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
256 strBuf.append("Types:");
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
257
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
258 if (extElements != null)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
259 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
260 Iterator extIterator = extElements.iterator();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
261
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
262 while (extIterator.hasNext())
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
263 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
264 strBuf.append("\n" + extIterator.next());
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
265 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
266 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
267
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
268 return strBuf.toString();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
269 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
270
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
271
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
272 }