View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: ParamHTTPType.java,v 1.14 2007/01/04 16:26:07 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.resource.dataservice;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.IOException;
15  import java.io.Reader;
16  import java.io.Serializable;
17  import java.io.Writer;
18  import java.util.ArrayList;
19  import java.util.Enumeration;
20  import org.astrogrid.registry.beans.resource.dataservice.types.HTTPQueryType;
21  import org.exolab.castor.xml.MarshalException;
22  import org.exolab.castor.xml.Marshaller;
23  import org.exolab.castor.xml.Unmarshaller;
24  import org.exolab.castor.xml.ValidationException;
25  import org.xml.sax.ContentHandler;
26  
27  /***
28   * Class ParamHTTPType.
29   * 
30   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:07 $
31   */
32  public class ParamHTTPType extends org.astrogrid.registry.beans.resource.dataservice.ExtendedInterfaceType 
33  implements java.io.Serializable
34  {
35  
36  
37        //--------------------------/
38       //- Class/Member Variables -/
39      //--------------------------/
40  
41      /***
42       * Field _qtype
43       */
44      private org.astrogrid.registry.beans.resource.dataservice.types.HTTPQueryType _qtype;
45  
46      /***
47       * The MIME type of a document returned by an HTTP Get.
48       *  
49       */
50      private java.lang.String _HTTPResults;
51  
52      /***
53       * an input parameter. This should be rendered
54       *  as name=value in the query URL's arguements. 
55       *  
56       */
57      private java.util.ArrayList _paramList;
58  
59  
60        //----------------/
61       //- Constructors -/
62      //----------------/
63  
64      public ParamHTTPType() {
65          super();
66          _paramList = new ArrayList();
67      } //-- org.astrogrid.registry.beans.resource.dataservice.ParamHTTPType()
68  
69  
70        //-----------/
71       //- Methods -/
72      //-----------/
73  
74      /***
75       * Method addParam
76       * 
77       * @param vParam
78       */
79      public void addParam(org.astrogrid.registry.beans.resource.dataservice.ParamType vParam)
80          throws java.lang.IndexOutOfBoundsException
81      {
82          _paramList.add(vParam);
83      } //-- void addParam(org.astrogrid.registry.beans.resource.dataservice.ParamType) 
84  
85      /***
86       * Method addParam
87       * 
88       * @param index
89       * @param vParam
90       */
91      public void addParam(int index, org.astrogrid.registry.beans.resource.dataservice.ParamType vParam)
92          throws java.lang.IndexOutOfBoundsException
93      {
94          _paramList.add(index, vParam);
95      } //-- void addParam(int, org.astrogrid.registry.beans.resource.dataservice.ParamType) 
96  
97      /***
98       * Method clearParam
99       */
100     public void clearParam()
101     {
102         _paramList.clear();
103     } //-- void clearParam() 
104 
105     /***
106      * Method enumerateParam
107      */
108     public java.util.Enumeration enumerateParam()
109     {
110         return new org.exolab.castor.util.IteratorEnumeration(_paramList.iterator());
111     } //-- java.util.Enumeration enumerateParam() 
112 
113     /***
114      * Note: hashCode() has not been overriden
115      * 
116      * @param obj
117      */
118     public boolean equals(java.lang.Object obj)
119     {
120         if ( this == obj )
121             return true;
122         
123         if (super.equals(obj)==false)
124             return false;
125         
126         if (obj instanceof ParamHTTPType) {
127         
128             ParamHTTPType temp = (ParamHTTPType)obj;
129             if (this._qtype != null) {
130                 if (temp._qtype == null) return false;
131                 else if (!(this._qtype.equals(temp._qtype))) 
132                     return false;
133             }
134             else if (temp._qtype != null)
135                 return false;
136             if (this._HTTPResults != null) {
137                 if (temp._HTTPResults == null) return false;
138                 else if (!(this._HTTPResults.equals(temp._HTTPResults))) 
139                     return false;
140             }
141             else if (temp._HTTPResults != null)
142                 return false;
143             if (this._paramList != null) {
144                 if (temp._paramList == null) return false;
145                 else if (!(this._paramList.equals(temp._paramList))) 
146                     return false;
147             }
148             else if (temp._paramList != null)
149                 return false;
150             return true;
151         }
152         return false;
153     } //-- boolean equals(java.lang.Object) 
154 
155     /***
156      * Returns the value of field 'HTTPResults'. The field
157      * 'HTTPResults' has the following description: The MIME type
158      * of a document returned by an HTTP Get.
159      *  
160      * 
161      * @return the value of field 'HTTPResults'.
162      */
163     public java.lang.String getHTTPResults()
164     {
165         return this._HTTPResults;
166     } //-- java.lang.String getHTTPResults() 
167 
168     /***
169      * Method getParam
170      * 
171      * @param index
172      */
173     public org.astrogrid.registry.beans.resource.dataservice.ParamType getParam(int index)
174         throws java.lang.IndexOutOfBoundsException
175     {
176         //-- check bounds for index
177         if ((index < 0) || (index > _paramList.size())) {
178             throw new IndexOutOfBoundsException();
179         }
180         
181         return (org.astrogrid.registry.beans.resource.dataservice.ParamType) _paramList.get(index);
182     } //-- org.astrogrid.registry.beans.resource.dataservice.ParamType getParam(int) 
183 
184     /***
185      * Method getParam
186      */
187     public org.astrogrid.registry.beans.resource.dataservice.ParamType[] getParam()
188     {
189         int size = _paramList.size();
190         org.astrogrid.registry.beans.resource.dataservice.ParamType[] mArray = new org.astrogrid.registry.beans.resource.dataservice.ParamType[size];
191         for (int index = 0; index < size; index++) {
192             mArray[index] = (org.astrogrid.registry.beans.resource.dataservice.ParamType) _paramList.get(index);
193         }
194         return mArray;
195     } //-- org.astrogrid.registry.beans.resource.dataservice.ParamType[] getParam() 
196 
197     /***
198      * Method getParamCount
199      */
200     public int getParamCount()
201     {
202         return _paramList.size();
203     } //-- int getParamCount() 
204 
205     /***
206      * Returns the value of field 'qtype'.
207      * 
208      * @return the value of field 'qtype'.
209      */
210     public org.astrogrid.registry.beans.resource.dataservice.types.HTTPQueryType getQtype()
211     {
212         return this._qtype;
213     } //-- org.astrogrid.registry.beans.resource.dataservice.types.HTTPQueryType getQtype() 
214 
215     /***
216      * Method isValid
217      */
218     public boolean isValid()
219     {
220         try {
221             validate();
222         }
223         catch (org.exolab.castor.xml.ValidationException vex) {
224             return false;
225         }
226         return true;
227     } //-- boolean isValid() 
228 
229     /***
230      * Method marshal
231      * 
232      * @param out
233      */
234     public void marshal(java.io.Writer out)
235         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
236     {
237         
238         Marshaller.marshal(this, out);
239     } //-- void marshal(java.io.Writer) 
240 
241     /***
242      * Method marshal
243      * 
244      * @param handler
245      */
246     public void marshal(org.xml.sax.ContentHandler handler)
247         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
248     {
249         
250         Marshaller.marshal(this, handler);
251     } //-- void marshal(org.xml.sax.ContentHandler) 
252 
253     /***
254      * Method removeParam
255      * 
256      * @param vParam
257      */
258     public boolean removeParam(org.astrogrid.registry.beans.resource.dataservice.ParamType vParam)
259     {
260         boolean removed = _paramList.remove(vParam);
261         return removed;
262     } //-- boolean removeParam(org.astrogrid.registry.beans.resource.dataservice.ParamType) 
263 
264     /***
265      * Sets the value of field 'HTTPResults'. The field
266      * 'HTTPResults' has the following description: The MIME type
267      * of a document returned by an HTTP Get.
268      *  
269      * 
270      * @param HTTPResults the value of field 'HTTPResults'.
271      */
272     public void setHTTPResults(java.lang.String HTTPResults)
273     {
274         this._HTTPResults = HTTPResults;
275     } //-- void setHTTPResults(java.lang.String) 
276 
277     /***
278      * Method setParam
279      * 
280      * @param index
281      * @param vParam
282      */
283     public void setParam(int index, org.astrogrid.registry.beans.resource.dataservice.ParamType vParam)
284         throws java.lang.IndexOutOfBoundsException
285     {
286         //-- check bounds for index
287         if ((index < 0) || (index > _paramList.size())) {
288             throw new IndexOutOfBoundsException();
289         }
290         _paramList.set(index, vParam);
291     } //-- void setParam(int, org.astrogrid.registry.beans.resource.dataservice.ParamType) 
292 
293     /***
294      * Method setParam
295      * 
296      * @param paramArray
297      */
298     public void setParam(org.astrogrid.registry.beans.resource.dataservice.ParamType[] paramArray)
299     {
300         //-- copy array
301         _paramList.clear();
302         for (int i = 0; i < paramArray.length; i++) {
303             _paramList.add(paramArray[i]);
304         }
305     } //-- void setParam(org.astrogrid.registry.beans.resource.dataservice.ParamType) 
306 
307     /***
308      * Sets the value of field 'qtype'.
309      * 
310      * @param qtype the value of field 'qtype'.
311      */
312     public void setQtype(org.astrogrid.registry.beans.resource.dataservice.types.HTTPQueryType qtype)
313     {
314         this._qtype = qtype;
315     } //-- void setQtype(org.astrogrid.registry.beans.resource.dataservice.types.HTTPQueryType) 
316 
317     /***
318      * Method unmarshalParamHTTPType
319      * 
320      * @param reader
321      */
322     public static org.astrogrid.registry.beans.resource.dataservice.ParamHTTPType unmarshalParamHTTPType(java.io.Reader reader)
323         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
324     {
325         return (org.astrogrid.registry.beans.resource.dataservice.ParamHTTPType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.dataservice.ParamHTTPType.class, reader);
326     } //-- org.astrogrid.registry.beans.resource.dataservice.ParamHTTPType unmarshalParamHTTPType(java.io.Reader) 
327 
328     /***
329      * Method validate
330      */
331     public void validate()
332         throws org.exolab.castor.xml.ValidationException
333     {
334         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
335         validator.validate(this);
336     } //-- void validate() 
337 
338 }