annotate WebServiceToolWorkflow/ParserForWADL/src/lsdis/WADLParserDriver.java @ 0:e7482c82796e 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 17:34:26 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
1 package lsdis;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
2 import java.net.MalformedURLException;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
3 import java.net.URL;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
4
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
5 import lsdis.*;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
6
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
7 import java.util.ArrayList;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
8 import java.util.List;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
9
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
10
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
11 /*
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
12 * generate url's and param names
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
13 */
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
14
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
15 public class WADLParserDriver {
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
16
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
17
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
18 // private List<List<String>> paramNames = new ArrayList<List<String>>();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
19 private List<Method> definedMethods = new ArrayList<Method>();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
20
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
21 private int count = 0;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
22 private List<Method> crossReferencedMethods = new ArrayList<Method>();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
23 private List<String> crossReferencedMethodURLS = new ArrayList<String>();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
24
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
25 private List<Method> completeMethodList = new ArrayList<Method>();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
26 private List<String> url = new ArrayList<String>();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
27
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
28
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
29 public List<Method> getCompleteMethodList() {
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
30 return completeMethodList;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
31 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
32
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
33 public List<String> getUrl() {
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
34 return url;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
35 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
36
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
37
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
38
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
39 public static void main(String[] args) throws Exception {
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
40
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
41 WADLParserDriver mpw = new WADLParserDriver();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
42 //mpw.parse(new URL("http://cs.uga.edu/~ganjoo/galaxy/DDBJNCBIGenomeAnnotationGetGeneList.wadl"));
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
43 mpw.parse(new URL("http://eupathdb.org/webservices/GeneQuestions/GenesByMolecularWeight.wadl"));
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
44 mpw.displayInfo();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
45
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
46 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
47
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
48 public void parse(URL fileURL) throws Exception {
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
49 int i=0;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
50
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
51
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
52
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
53 //URL fileURL = new URL("http://www.eupathdb.org/webservices/GeneQuestions/GenesByMolecularWeight.wadl");
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
54
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
55 WADLParser wadlP = new WADLParser(fileURL);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
56
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
57 Application app= new Application();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
58 app=wadlP.getApplicationOfWADL();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
59
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
60 String temp = "";
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
61 String tempHref="";
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
62
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
63 for(Resources resources : app.getResources()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
64 temp = resources.getBase().toString();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
65 //traverseSubResources(temp, resources);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
66 System.out.println(temp);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
67 for(Resource resource : resources.getResources()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
68
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
69 temp = temp + resource.getPath();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
70 traverseResource(temp, resource);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
71 //traverseSubResources(temp, resource);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
72 System.out.println("resource path"+resource.getPath());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
73 if(resource.getParams()!=null && resource.getParams().size()!=0){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
74 for(Param param: resource.getParams()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
75 System.out.println("params "+ param);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
76 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
77 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
78
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
79
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
80 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
81
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
82 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
83
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
84 traverseCrossReferencedMethods();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
85 displayInfo();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
86
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
87 }//end main
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
88
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
89
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
90 public void traverseSubResources(String passedString,Resource resource){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
91
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
92
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
93
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
94
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
95 for(Resource subResource : resource.getResources()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
96
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
97 String temp = passedString;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
98
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
99 if(temp.charAt(temp.length()-1) != '/')
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
100 temp += "/";
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
101 temp += subResource.getPath();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
102
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
103 // if(subResource.getParams()!=null && subResource.getParams().size()!=0){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
104 // for(Param param: subResource.getParams()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
105 // if(param.getStyle().equalsIgnoreCase("template")){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
106 // System.out.println("params "+ param.getName());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
107 // temp=temp+"/{"+param.getName()+"}";
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
108 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
109 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
110 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
111
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
112 //start
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
113
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
114
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
115 for(Method method : subResource.getMethods()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
116 if(method.getId() != null){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
117 url.add(count, temp);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
118 definedMethods.add(method);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
119
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
120 completeMethodList.add(count,method);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
121
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
122 count++;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
123 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
124 else if(method.getHref()!=null){ //will work only for intra-document cross-reference currently
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
125
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
126 crossReferencedMethods.add(method);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
127 crossReferencedMethodURLS.add(temp);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
128
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
129 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
130 else{
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
131
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
132 System.out.println("ERROR : Method " + method.getName() + " does not have an id or a href !!" );
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
133 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
134 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
135
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
136
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
137 traverseSubResources(temp, subResource);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
138
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
139 }//end for
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
140
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
141 }//end method
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
142
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
143 public void traverseResource(String passedString,Resource resource){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
144
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
145
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
146
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
147 String temp = passedString ;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
148
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
149 //start
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
150
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
151
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
152 for(Method method : resource.getMethods()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
153 if(method.getId() != null){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
154 url.add(count, temp);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
155 definedMethods.add(method);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
156
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
157 completeMethodList.add(count,method);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
158
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
159 count++;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
160 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
161 else if(method.getHref()!=null){ //will work only for intra-document cross-reference currently
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
162
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
163 crossReferencedMethods.add(method);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
164 crossReferencedMethodURLS.add(temp);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
165
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
166 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
167 else{
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
168
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
169 System.out.println("ERROR : Method " + method.getName() + " does not have an id or a href !!" );
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
170 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
171 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
172
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
173
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
174 traverseSubResources(temp, resource);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
175
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
176 }//end method
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
177
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
178 public void traverseCrossReferencedMethods(){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
179 int i =0;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
180 String tempHref = "";
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
181
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
182 for(Method method : crossReferencedMethods){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
183
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
184 url.add(count, crossReferencedMethodURLS.get(i));
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
185
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
186
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
187
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
188 tempHref = method.getHref().toString();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
189 if(tempHref.startsWith("#")){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
190 tempHref = tempHref.substring(1);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
191 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
192
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
193 for(Method m : definedMethods){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
194 if(m.getId().equals(tempHref)){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
195
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
196 Method tempMethod = new Method(m.getDocs(),m.getRequest(),m.getResponse(),m.getId(),m.getName(),method.getHref());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
197 completeMethodList.add(count,tempMethod);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
198
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
199 break;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
200
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
201 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
202
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
203 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
204
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
205 count++;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
206 i++;
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
207 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
208
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
209
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
210
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
211 }//end of method
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
212
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
213 // public void displayInfo(){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
214 // if(url.size()!=paramNames.size()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
215 // System.out.println("Debug the code !!!! :( ");
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
216 // System.exit(0);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
217 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
218 // for(int i=0;i<url.size();i++){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
219 // System.out.println(url.get(i));
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
220 //
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
221 // for(String p : paramNames.get(i)){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
222 // System.out.print(p + ", ");
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
223 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
224 //
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
225 // System.out.println();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
226 // System.out.println();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
227 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
228 //
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
229 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
230
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
231 public void displayInfo(){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
232
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
233 if(url.size()!=completeMethodList.size()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
234 System.out.println("Debug the code !!!! :( ");
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
235 System.exit(0);
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
236 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
237 for(int i=0;i<url.size();i++){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
238 System.out.println(url.get(i));
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
239
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
240 for(Method m : completeMethodList){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
241 System.out.println(m.getName());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
242 for(Param param : m.getRequest().getParams()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
243 System.out.println("\t"+param.getName());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
244 System.out.println("\t"+param.isRequired());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
245 for(Doc doc : param.getDocs()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
246 if(doc.getTitle().equalsIgnoreCase("prompt")){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
247 System.out.println("Prompt: " + doc.getInnerText());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
248 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
249
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
250 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
251 List<Option> ops = param.getOptions();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
252
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
253 // if(ops.size()==0){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
254 // System.out.println("No options available");
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
255 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
256 // else{
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
257 // System.out.println("\t options:");
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
258 //
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
259 // for(Option option:param.getOptions()){
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
260 // System.out.println("\t "+option.getName());
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
261 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
262 // }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
263 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
264 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
265
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
266 System.out.println();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
267 System.out.println();
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
268 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
269 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
270 }
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
271
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
272
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
273
e7482c82796e Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
274