-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathService.java
More file actions
107 lines (90 loc) · 3.25 KB
/
Copy pathService.java
File metadata and controls
107 lines (90 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package javaxt.webservices;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.NamedNodeMap;
import javaxt.xml.DOM;
//******************************************************************************
//** Service Class
//******************************************************************************
/**
* Used to represent a web service.
*
******************************************************************************/
public class Service {
private String Name = "";
private String Description = "";
private String URL = "";
private String NameSpace;
private Method[] Methods = null;
//**************************************************************************
//** Constructor
//**************************************************************************
/** Instantiates this class using a "Service" node from an SSD.
*/
protected Service(Node ServiceNode){
NamedNodeMap attr = ServiceNode.getAttributes();
Name = DOM.getAttributeValue(attr, "name");
NameSpace = DOM.getAttributeValue(attr, "namespace");
URL = DOM.getAttributeValue(attr, "url");
NodeList ChildNodes = ServiceNode.getChildNodes();
for (int j=0; j<ChildNodes.getLength(); j++ ) {
if (ChildNodes.item(j).getNodeType()==1){
String NodeName = ChildNodes.item(j).getNodeName();
String NodeValue = ChildNodes.item(j).getTextContent();
if (NodeName.toLowerCase().equals("description")){
Description = NodeValue;
}
if (NodeName.toLowerCase().equals("methods")){
NodeList methodNodes = ChildNodes.item(j).getChildNodes();
java.util.ArrayList<Method> methods = new java.util.ArrayList<Method>();
for (Node methodNode : DOM.getNodes(methodNodes)){
methods.add(new Method(methodNode));
}
if (!methods.isEmpty()){
Methods = methods.toArray(new Method[methods.size()]);
}
}
}
}
}
public String getName(){return Name;}
public String getDescription(){return Description;}
public String getURL(){return URL;}
public String getNameSpace(){return NameSpace;}
public Method[] getMethods(){return Methods;}
//Equals
public boolean equals(String ServiceName){
return Name.equalsIgnoreCase(ServiceName);
}
//Get Method
public Method getMethod(String MethodName){
if (MethodName==null) MethodName = "";
else MethodName = MethodName.trim();
if (MethodName.equals("")){
return getMethod(0);
}
else{
for (int i=0; i<Methods.length; i++){
if (Methods[i].equals(MethodName)){
return Methods[i];
}
}
}
return null;
}
//Get Method
public Method getMethod(int i){
if (Methods==null){
return getMethod(0);
}
else{
if (i<Methods.length){
return Methods[i];
}
}
return null;
}
public void setURL(String URL){
this.URL = URL;
}
}