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.astrogrid.registry.beans.v10.resource.types.AccessURLUseType;
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 * Class AccessURL.
27 *
28 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
29 */
30 public class AccessURL extends org.astrogrid.common.bean.BaseBean
31 implements java.io.Serializable
32 {
33
34
35
36
37
38
39 /***
40 * internal content storage
41 */
42 private java.lang.String _content;
43
44 /***
45 * A flag indicating whether this should be interpreted as a
46 * base
47 * URL, a full URL, or a URL to a directory that will produce
48 * a
49 * listing of files.
50 *
51 */
52 private org.astrogrid.registry.beans.v10.resource.types.AccessURLUseType _use;
53
54
55
56
57
58
59 public AccessURL() {
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 AccessURL) {
82
83 AccessURL temp = (AccessURL)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._use != null) {
92 if (temp._use == null) return false;
93 else if (!(this._use.equals(temp._use)))
94 return false;
95 }
96 else if (temp._use != 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 'use'. The field 'use' has the
116 * following description: A flag indicating whether this should
117 * be interpreted as a base
118 * URL, a full URL, or a URL to a directory that will produce
119 * a
120 * listing of files.
121 *
122 *
123 * @return the value of field 'use'.
124 */
125 public org.astrogrid.registry.beans.v10.resource.types.AccessURLUseType getUse()
126 {
127 return this._use;
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 'content'. The field 'content' has
170 * the following description: internal content storage
171 *
172 * @param content the value of field 'content'.
173 */
174 public void setContent(java.lang.String content)
175 {
176 this._content = content;
177 }
178
179 /***
180 * Sets the value of field 'use'. The field 'use' has the
181 * following description: A flag indicating whether this should
182 * be interpreted as a base
183 * URL, a full URL, or a URL to a directory that will produce
184 * a
185 * listing of files.
186 *
187 *
188 * @param use the value of field 'use'.
189 */
190 public void setUse(org.astrogrid.registry.beans.v10.resource.types.AccessURLUseType use)
191 {
192 this._use = use;
193 }
194
195 /***
196 * Method unmarshalAccessURL
197 *
198 * @param reader
199 */
200 public static org.astrogrid.registry.beans.v10.resource.AccessURL unmarshalAccessURL(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.AccessURL) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.AccessURL.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 }