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