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 * the name of a potentially registered resource. That is, the
26 * entity
27 * referred to may have an associated identifier.
28 *
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
31 */
32 public class ResourceName extends org.astrogrid.common.bean.BaseBean
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * internal content storage
43 */
44 private java.lang.String _content = "";
45
46 /***
47 * The URI form of the IVOA identifier for the resource refered
48 * to
49 *
50 */
51 private java.lang.String _ivoId;
52
53
54
55
56
57
58 public ResourceName() {
59 super();
60 setContent("");
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 ResourceName) {
82
83 ResourceName temp = (ResourceName)obj;
84 if (this._content != null) {
85 if (temp._content == null) return false;
86 else if (!(this._content.equals(temp._content)))
87 return false;
88 }
89 else if (temp._content != null)
90 return false;
91 if (this._ivoId != null) {
92 if (temp._ivoId == null) return false;
93 else if (!(this._ivoId.equals(temp._ivoId)))
94 return false;
95 }
96 else if (temp._ivoId != null)
97 return false;
98 return true;
99 }
100 return false;
101 }
102
103 /***
104 * Returns the value of field 'content'. The field 'content'
105 * has the following description: internal content storage
106 *
107 * @return the value of field 'content'.
108 */
109 public java.lang.String getContent()
110 {
111 return this._content;
112 }
113
114 /***
115 * Returns the value of field 'ivoId'. The field 'ivoId' has
116 * the following description: The URI form of the IVOA
117 * identifier for the resource refered to
118 *
119 *
120 * @return the value of field 'ivoId'.
121 */
122 public java.lang.String getIvoId()
123 {
124 return this._ivoId;
125 }
126
127 /***
128 * Method isValid
129 */
130 public boolean isValid()
131 {
132 try {
133 validate();
134 }
135 catch (org.exolab.castor.xml.ValidationException vex) {
136 return false;
137 }
138 return true;
139 }
140
141 /***
142 * Method marshal
143 *
144 * @param out
145 */
146 public void marshal(java.io.Writer out)
147 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
148 {
149
150 Marshaller.marshal(this, out);
151 }
152
153 /***
154 * Method marshal
155 *
156 * @param handler
157 */
158 public void marshal(org.xml.sax.ContentHandler handler)
159 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
160 {
161
162 Marshaller.marshal(this, handler);
163 }
164
165 /***
166 * Sets the value of field 'content'. The field 'content' has
167 * the following description: internal content storage
168 *
169 * @param content the value of field 'content'.
170 */
171 public void setContent(java.lang.String content)
172 {
173 this._content = content;
174 }
175
176 /***
177 * Sets the value of field 'ivoId'. The field 'ivoId' has the
178 * following description: The URI form of the IVOA identifier
179 * for the resource refered to
180 *
181 *
182 * @param ivoId the value of field 'ivoId'.
183 */
184 public void setIvoId(java.lang.String ivoId)
185 {
186 this._ivoId = ivoId;
187 }
188
189 /***
190 * Method unmarshalResourceName
191 *
192 * @param reader
193 */
194 public static org.astrogrid.registry.beans.v10.resource.ResourceName unmarshalResourceName(java.io.Reader reader)
195 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
196 {
197 return (org.astrogrid.registry.beans.v10.resource.ResourceName) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.ResourceName.class, reader);
198 }
199
200 /***
201 * Method validate
202 */
203 public void validate()
204 throws org.exolab.castor.xml.ValidationException
205 {
206 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
207 validator.validate(this);
208 }
209
210 }