1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.astrogrid.registry.beans.resource.types.InvocationType;
19 import org.exolab.castor.xml.MarshalException;
20 import org.exolab.castor.xml.Marshaller;
21 import org.exolab.castor.xml.Unmarshaller;
22 import org.exolab.castor.xml.ValidationException;
23 import org.xml.sax.ContentHandler;
24
25 /***
26 * This is typically used as a base type for defining specific
27 * kinds of service interfaces. If this type is used
28 * directly, the Description element should be used to describe
29 * how to invoke the service.
30 *
31 *
32 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:22 $
33 */
34 public class InterfaceType extends org.astrogrid.common.bean.BaseBean
35 implements java.io.Serializable
36 {
37
38
39
40
41
42
43 /***
44 * The type of interface used by the current Service,
45 * expressed as a controlled name.
46 *
47 */
48 private org.astrogrid.registry.beans.resource.types.InvocationType _invocation;
49
50 /***
51 * Specifically, a textual description of the interface.
52 *
53 */
54 private java.lang.String _description;
55
56 /***
57 * Whether this refers to a base or full URL depends on
58 * the specific class of interface. If
59 *
60 */
61 private org.astrogrid.registry.beans.resource.AccessURLType _accessURL;
62
63
64
65
66
67
68 public InterfaceType() {
69 super();
70 }
71
72
73
74
75
76
77 /***
78 * Note: hashCode() has not been overriden
79 *
80 * @param obj
81 */
82 public boolean equals(java.lang.Object obj)
83 {
84 if ( this == obj )
85 return true;
86
87 if (super.equals(obj)==false)
88 return false;
89
90 if (obj instanceof InterfaceType) {
91
92 InterfaceType temp = (InterfaceType)obj;
93 if (this._invocation != null) {
94 if (temp._invocation == null) return false;
95 else if (!(this._invocation.equals(temp._invocation)))
96 return false;
97 }
98 else if (temp._invocation != null)
99 return false;
100 if (this._description != null) {
101 if (temp._description == null) return false;
102 else if (!(this._description.equals(temp._description)))
103 return false;
104 }
105 else if (temp._description != null)
106 return false;
107 if (this._accessURL != null) {
108 if (temp._accessURL == null) return false;
109 else if (!(this._accessURL.equals(temp._accessURL)))
110 return false;
111 }
112 else if (temp._accessURL != null)
113 return false;
114 return true;
115 }
116 return false;
117 }
118
119 /***
120 * Returns the value of field 'accessURL'. The field
121 * 'accessURL' has the following description: Whether this
122 * refers to a base or full URL depends on
123 * the specific class of interface. If
124 *
125 *
126 * @return the value of field 'accessURL'.
127 */
128 public org.astrogrid.registry.beans.resource.AccessURLType getAccessURL()
129 {
130 return this._accessURL;
131 }
132
133 /***
134 * Returns the value of field 'description'. The field
135 * 'description' has the following description: Specifically, a
136 * textual description of the interface.
137 *
138 *
139 * @return the value of field 'description'.
140 */
141 public java.lang.String getDescription()
142 {
143 return this._description;
144 }
145
146 /***
147 * Returns the value of field 'invocation'. The field
148 * 'invocation' has the following description: The type of
149 * interface used by the current Service,
150 * expressed as a controlled name.
151 *
152 *
153 * @return the value of field 'invocation'.
154 */
155 public org.astrogrid.registry.beans.resource.types.InvocationType getInvocation()
156 {
157 return this._invocation;
158 }
159
160 /***
161 * Method isValid
162 */
163 public boolean isValid()
164 {
165 try {
166 validate();
167 }
168 catch (org.exolab.castor.xml.ValidationException vex) {
169 return false;
170 }
171 return true;
172 }
173
174 /***
175 * Method marshal
176 *
177 * @param out
178 */
179 public void marshal(java.io.Writer out)
180 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
181 {
182
183 Marshaller.marshal(this, out);
184 }
185
186 /***
187 * Method marshal
188 *
189 * @param handler
190 */
191 public void marshal(org.xml.sax.ContentHandler handler)
192 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
193 {
194
195 Marshaller.marshal(this, handler);
196 }
197
198 /***
199 * Sets the value of field 'accessURL'. The field 'accessURL'
200 * has the following description: Whether this refers to a base
201 * or full URL depends on
202 * the specific class of interface. If
203 *
204 *
205 * @param accessURL the value of field 'accessURL'.
206 */
207 public void setAccessURL(org.astrogrid.registry.beans.resource.AccessURLType accessURL)
208 {
209 this._accessURL = accessURL;
210 }
211
212 /***
213 * Sets the value of field 'description'. The field
214 * 'description' has the following description: Specifically, a
215 * textual description of the interface.
216 *
217 *
218 * @param description the value of field 'description'.
219 */
220 public void setDescription(java.lang.String description)
221 {
222 this._description = description;
223 }
224
225 /***
226 * Sets the value of field 'invocation'. The field 'invocation'
227 * has the following description: The type of interface used by
228 * the current Service,
229 * expressed as a controlled name.
230 *
231 *
232 * @param invocation the value of field 'invocation'.
233 */
234 public void setInvocation(org.astrogrid.registry.beans.resource.types.InvocationType invocation)
235 {
236 this._invocation = invocation;
237 }
238
239 /***
240 * Method unmarshalInterfaceType
241 *
242 * @param reader
243 */
244 public static org.astrogrid.registry.beans.resource.InterfaceType unmarshalInterfaceType(java.io.Reader reader)
245 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
246 {
247 return (org.astrogrid.registry.beans.resource.InterfaceType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.InterfaceType.class, reader);
248 }
249
250 /***
251 * Method validate
252 */
253 public void validate()
254 throws org.exolab.castor.xml.ValidationException
255 {
256 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
257 validator.validate(this);
258 }
259
260 }