|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
WebServiceConfig.java | 0% | 0% | 0% | 0% |
|
1 | /** | |
2 | * JTRunner is free software; you can redistribute it and/or modify it under the | |
3 | * terms of the GNU General Public License as published by the Free Software | |
4 | * Foundation; either version 2, or (at your option) any later version. | |
5 | */ | |
6 | ||
7 | package jtr.config.ws; | |
8 | ||
9 | import java.io.Serializable; | |
10 | import java.util.Collection; | |
11 | import java.util.HashMap; | |
12 | ||
13 | import javax.xml.namespace.QName; | |
14 | ||
15 | /** | |
16 | * This class is the object oriented representation of the content | |
17 | * of a <code>webservice</code> element of the <code>jtr.xml</code> | |
18 | * configuration file.<br> | |
19 | * Every <code>webservice</code> description is logically associated | |
20 | * with a WSDL, thus you are required to point out a valid WSDL location | |
21 | * as an URL when defining every <code>webservice</code> element.<br> | |
22 | * Nested in a <code>WebServiceConfig</code> there might be one or more | |
23 | * services according to your needs. Each service is represented by | |
24 | * a <code>WebServiceService</code> instance. | |
25 | * | |
26 | * @see jtr.config.ws.WebServiceService | |
27 | * @author Francesco Russo (frusso@dev.java.net) | |
28 | * @version 4.0 | |
29 | * @since 3.0 | |
30 | */ | |
31 | public class WebServiceConfig implements Serializable { | |
32 | /** | |
33 | * Default constructor. | |
34 | */ | |
35 | 0 | public WebServiceConfig() { |
36 | 0 | services = new HashMap<QName,WebServiceService>(); |
37 | } | |
38 | ||
39 | /** | |
40 | * Add a webservice definition to the current configuration. | |
41 | * @param service The new service description | |
42 | */ | |
43 | 0 | public void addService(WebServiceService service) { |
44 | 0 | assert service!=null; |
45 | 0 | services.put(new QName(service.getNameSpace(),service.getName()),service); |
46 | } | |
47 | ||
48 | /** | |
49 | * Return the collection of currently configured services. | |
50 | * @return Collection<WebServiceService> | |
51 | */ | |
52 | 0 | public Collection<WebServiceService> getServices() { |
53 | 0 | return services.values(); |
54 | } | |
55 | ||
56 | /** | |
57 | * Get this webservice configuration's unique name. | |
58 | * @return String The webservice configuration unique name | |
59 | */ | |
60 | 0 | public String getUniqueName() { |
61 | 0 | return uniqueName; |
62 | } | |
63 | ||
64 | /** | |
65 | * Set the location of the WSDL file associated with the current | |
66 | * JTR webservice configuration.<br> | |
67 | * This location has to be expressed as a valid URI. | |
68 | * @param wsdlLocation The WSDL location | |
69 | */ | |
70 | 0 | public void setWsdlLocation(String wsdlLocation) { |
71 | 0 | this.wsdlLocation = wsdlLocation; |
72 | } | |
73 | ||
74 | /** | |
75 | * Set the collection of services for the current JTR webservice configuration. | |
76 | * @param services The services | |
77 | */ | |
78 | 0 | public void setServices(Collection<WebServiceService> services) { |
79 | 0 | assert services!=null; |
80 | 0 | for(WebServiceService service : services) { |
81 | 0 | addService(service); |
82 | } | |
83 | } | |
84 | ||
85 | /** | |
86 | * Set the unique name of this JTR webservice configuration. | |
87 | * @param uniqueName The unique name | |
88 | */ | |
89 | 0 | public void setUniqueName(String uniqueName) { |
90 | 0 | this.uniqueName = uniqueName; |
91 | } | |
92 | ||
93 | /** | |
94 | * Get the WSDL's location. | |
95 | * @return String The location of the WSDL | |
96 | */ | |
97 | 0 | public String getWsdlLocation() { |
98 | 0 | return wsdlLocation; |
99 | } | |
100 | ||
101 | /** | |
102 | * @see java.lang.Object#toString() | |
103 | */ | |
104 | 0 | public String toString() { |
105 | 0 | return "\nUniqueName: " + uniqueName + "\n" + "WSDL Location: " + wsdlLocation + "\n" + "Services: " + services; |
106 | } | |
107 | ||
108 | /** | |
109 | * Get a simgle service by qualified name. This method may return <code>null</code>. | |
110 | * @param nameSpace | |
111 | * @param name | |
112 | * @return WebServiceService | |
113 | */ | |
114 | 0 | public WebServiceService getService(String nameSpace, String name) { |
115 | 0 | return services.get(new QName(nameSpace,name)); |
116 | } | |
117 | ||
118 | /** | |
119 | * Get a simgle service by qualified name. This method may return <code>null</code>. | |
120 | * @param qName | |
121 | * @return WebServiceService | |
122 | */ | |
123 | 0 | public WebServiceService getService(QName qName) { |
124 | 0 | return services.get(qName); |
125 | } | |
126 | ||
127 | private String uniqueName; | |
128 | ||
129 | private String wsdlLocation; | |
130 | ||
131 | private HashMap<QName,WebServiceService> services; | |
132 | } |
|