1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.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.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * To provide a metadata specific to a particular Service type,
26 * this type is usually extended and added as a child of the
27 * specific Service subclass.
28 *
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
31 */
32 public class Capability extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * An IVOA identifier for a standard service.
43 *
44 */
45 private java.lang.String _standardID;
46
47 /***
48 * A URL that points to a human-readable document that
49 * describes the standard upon which a service is based.
50 *
51 */
52 private java.lang.String _standardURL;
53
54
55
56
57
58
59 public Capability() {
60 super();
61 }
62
63
64
65
66
67
68 /***
69 * Note: hashCode() has not been overriden
70 *
71 * @param obj
72 */
73 public boolean equals(java.lang.Object obj)
74 {
75 if ( this == obj )
76 return true;
77
78 if (super.equals(obj)==false)
79 return false;
80
81 if (obj instanceof Capability) {
82
83 Capability temp = (Capability)obj;
84 if (this._standardID != null) {
85 if (temp._standardID == null) return false;
86 else if (!(this._standardID.equals(temp._standardID)))
87 return false;
88 }
89 else if (temp._standardID != null)
90 return false;
91 if (this._standardURL != null) {
92 if (temp._standardURL == null) return false;
93 else if (!(this._standardURL.equals(temp._standardURL)))
94 return false;
95 }
96 else if (temp._standardURL != null)
97 return false;
98 return true;
99 }
100 return false;
101 }
102
103 /***
104 * Returns the value of field 'standardID'. The field
105 * 'standardID' has the following description: An IVOA
106 * identifier for a standard service.
107 *
108 *
109 * @return the value of field 'standardID'.
110 */
111 public java.lang.String getStandardID()
112 {
113 return this._standardID;
114 }
115
116 /***
117 * Returns the value of field 'standardURL'. The field
118 * 'standardURL' has the following description: A URL that
119 * points to a human-readable document that
120 * describes the standard upon which a service is based.
121 *
122 *
123 * @return the value of field 'standardURL'.
124 */
125 public java.lang.String getStandardURL()
126 {
127 return this._standardURL;
128 }
129
130 /***
131 * Method isValid
132 */
133 public boolean isValid()
134 {
135 try {
136 validate();
137 }
138 catch (org.exolab.castor.xml.ValidationException vex) {
139 return false;
140 }
141 return true;
142 }
143
144 /***
145 * Method marshal
146 *
147 * @param out
148 */
149 public void marshal(java.io.Writer out)
150 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
151 {
152
153 Marshaller.marshal(this, out);
154 }
155
156 /***
157 * Method marshal
158 *
159 * @param handler
160 */
161 public void marshal(org.xml.sax.ContentHandler handler)
162 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
163 {
164
165 Marshaller.marshal(this, handler);
166 }
167
168 /***
169 * Sets the value of field 'standardID'. The field 'standardID'
170 * has the following description: An IVOA identifier for a
171 * standard service.
172 *
173 *
174 * @param standardID the value of field 'standardID'.
175 */
176 public void setStandardID(java.lang.String standardID)
177 {
178 this._standardID = standardID;
179 }
180
181 /***
182 * Sets the value of field 'standardURL'. The field
183 * 'standardURL' has the following description: A URL that
184 * points to a human-readable document that
185 * describes the standard upon which a service is based.
186 *
187 *
188 * @param standardURL the value of field 'standardURL'.
189 */
190 public void setStandardURL(java.lang.String standardURL)
191 {
192 this._standardURL = standardURL;
193 }
194
195 /***
196 * Method unmarshalCapability
197 *
198 * @param reader
199 */
200 public static org.astrogrid.registry.beans.v10.resource.Capability unmarshalCapability(java.io.Reader reader)
201 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
202 {
203 return (org.astrogrid.registry.beans.v10.resource.Capability) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Capability.class, reader);
204 }
205
206 /***
207 * Method validate
208 */
209 public void validate()
210 throws org.exolab.castor.xml.ValidationException
211 {
212 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
213 validator.validate(this);
214 }
215
216 }