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: CommandLineApplication.java,v 1.2 2007/01/04 16:26:20 clq2 Exp $
6    */
7   
8   package org.astrogrid.applications.beans.v1.cea.implementation;
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.exolab.castor.xml.MarshalException;
21  import org.exolab.castor.xml.Marshaller;
22  import org.exolab.castor.xml.Unmarshaller;
23  import org.exolab.castor.xml.ValidationException;
24  import org.xml.sax.ContentHandler;
25  
26  /***
27   * Description of a command line application
28   * 
29   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:20 $
30   */
31  public class CommandLineApplication extends org.astrogrid.applications.beans.v1.ApplicationBase 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /***
41       * This is the file path of the executable
42       */
43      private java.lang.String _executionPath;
44  
45      /***
46       * Field _longName
47       */
48      private java.lang.String _longName;
49  
50      /***
51       * this should probably be in the main schema somewhere...
52       */
53      private java.lang.String _version;
54  
55      /***
56       * A description of the application that can become part of the
57       * registry entry
58       */
59      private java.lang.String _description;
60  
61      /***
62       * references to on-line information about the application
63       */
64      private java.util.ArrayList _referenceURLList;
65  
66  
67        //----------------/
68       //- Constructors -/
69      //----------------/
70  
71      public CommandLineApplication() {
72          super();
73          _referenceURLList = new ArrayList();
74      } //-- org.astrogrid.applications.beans.v1.cea.implementation.CommandLineApplication()
75  
76  
77        //-----------/
78       //- Methods -/
79      //-----------/
80  
81      /***
82       * Method addReferenceURL
83       * 
84       * @param vReferenceURL
85       */
86      public void addReferenceURL(java.lang.String vReferenceURL)
87          throws java.lang.IndexOutOfBoundsException
88      {
89          _referenceURLList.add(vReferenceURL);
90      } //-- void addReferenceURL(java.lang.String) 
91  
92      /***
93       * Method addReferenceURL
94       * 
95       * @param index
96       * @param vReferenceURL
97       */
98      public void addReferenceURL(int index, java.lang.String vReferenceURL)
99          throws java.lang.IndexOutOfBoundsException
100     {
101         _referenceURLList.add(index, vReferenceURL);
102     } //-- void addReferenceURL(int, java.lang.String) 
103 
104     /***
105      * Method clearReferenceURL
106      */
107     public void clearReferenceURL()
108     {
109         _referenceURLList.clear();
110     } //-- void clearReferenceURL() 
111 
112     /***
113      * Method enumerateReferenceURL
114      */
115     public java.util.Enumeration enumerateReferenceURL()
116     {
117         return new org.exolab.castor.util.IteratorEnumeration(_referenceURLList.iterator());
118     } //-- java.util.Enumeration enumerateReferenceURL() 
119 
120     /***
121      * Note: hashCode() has not been overriden
122      * 
123      * @param obj
124      */
125     public boolean equals(java.lang.Object obj)
126     {
127         if ( this == obj )
128             return true;
129         
130         if (super.equals(obj)==false)
131             return false;
132         
133         if (obj instanceof CommandLineApplication) {
134         
135             CommandLineApplication temp = (CommandLineApplication)obj;
136             if (this._executionPath != null) {
137                 if (temp._executionPath == null) return false;
138                 else if (!(this._executionPath.equals(temp._executionPath))) 
139                     return false;
140             }
141             else if (temp._executionPath != null)
142                 return false;
143             if (this._longName != null) {
144                 if (temp._longName == null) return false;
145                 else if (!(this._longName.equals(temp._longName))) 
146                     return false;
147             }
148             else if (temp._longName != null)
149                 return false;
150             if (this._version != null) {
151                 if (temp._version == null) return false;
152                 else if (!(this._version.equals(temp._version))) 
153                     return false;
154             }
155             else if (temp._version != null)
156                 return false;
157             if (this._description != null) {
158                 if (temp._description == null) return false;
159                 else if (!(this._description.equals(temp._description))) 
160                     return false;
161             }
162             else if (temp._description != null)
163                 return false;
164             if (this._referenceURLList != null) {
165                 if (temp._referenceURLList == null) return false;
166                 else if (!(this._referenceURLList.equals(temp._referenceURLList))) 
167                     return false;
168             }
169             else if (temp._referenceURLList != null)
170                 return false;
171             return true;
172         }
173         return false;
174     } //-- boolean equals(java.lang.Object) 
175 
176     /***
177      * Returns the value of field 'description'. The field
178      * 'description' has the following description: A description
179      * of the application that can become part of the registry
180      * entry
181      * 
182      * @return the value of field 'description'.
183      */
184     public java.lang.String getDescription()
185     {
186         return this._description;
187     } //-- java.lang.String getDescription() 
188 
189     /***
190      * Returns the value of field 'executionPath'. The field
191      * 'executionPath' has the following description: This is the
192      * file path of the executable
193      * 
194      * @return the value of field 'executionPath'.
195      */
196     public java.lang.String getExecutionPath()
197     {
198         return this._executionPath;
199     } //-- java.lang.String getExecutionPath() 
200 
201     /***
202      * Returns the value of field 'longName'.
203      * 
204      * @return the value of field 'longName'.
205      */
206     public java.lang.String getLongName()
207     {
208         return this._longName;
209     } //-- java.lang.String getLongName() 
210 
211     /***
212      * Method getReferenceURL
213      * 
214      * @param index
215      */
216     public java.lang.String getReferenceURL(int index)
217         throws java.lang.IndexOutOfBoundsException
218     {
219         //-- check bounds for index
220         if ((index < 0) || (index > _referenceURLList.size())) {
221             throw new IndexOutOfBoundsException();
222         }
223         
224         return (String)_referenceURLList.get(index);
225     } //-- java.lang.String getReferenceURL(int) 
226 
227     /***
228      * Method getReferenceURL
229      */
230     public java.lang.String[] getReferenceURL()
231     {
232         int size = _referenceURLList.size();
233         java.lang.String[] mArray = new java.lang.String[size];
234         for (int index = 0; index < size; index++) {
235             mArray[index] = (String)_referenceURLList.get(index);
236         }
237         return mArray;
238     } //-- java.lang.String[] getReferenceURL() 
239 
240     /***
241      * Method getReferenceURLCount
242      */
243     public int getReferenceURLCount()
244     {
245         return _referenceURLList.size();
246     } //-- int getReferenceURLCount() 
247 
248     /***
249      * Returns the value of field 'version'. The field 'version'
250      * has the following description: this should probably be in
251      * the main schema somewhere...
252      * 
253      * @return the value of field 'version'.
254      */
255     public java.lang.String getVersion()
256     {
257         return this._version;
258     } //-- java.lang.String getVersion() 
259 
260     /***
261      * Method isValid
262      */
263     public boolean isValid()
264     {
265         try {
266             validate();
267         }
268         catch (org.exolab.castor.xml.ValidationException vex) {
269             return false;
270         }
271         return true;
272     } //-- boolean isValid() 
273 
274     /***
275      * Method marshal
276      * 
277      * @param out
278      */
279     public void marshal(java.io.Writer out)
280         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
281     {
282         
283         Marshaller.marshal(this, out);
284     } //-- void marshal(java.io.Writer) 
285 
286     /***
287      * Method marshal
288      * 
289      * @param handler
290      */
291     public void marshal(org.xml.sax.ContentHandler handler)
292         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
293     {
294         
295         Marshaller.marshal(this, handler);
296     } //-- void marshal(org.xml.sax.ContentHandler) 
297 
298     /***
299      * Method removeReferenceURL
300      * 
301      * @param vReferenceURL
302      */
303     public boolean removeReferenceURL(java.lang.String vReferenceURL)
304     {
305         boolean removed = _referenceURLList.remove(vReferenceURL);
306         return removed;
307     } //-- boolean removeReferenceURL(java.lang.String) 
308 
309     /***
310      * Sets the value of field 'description'. The field
311      * 'description' has the following description: A description
312      * of the application that can become part of the registry
313      * entry
314      * 
315      * @param description the value of field 'description'.
316      */
317     public void setDescription(java.lang.String description)
318     {
319         this._description = description;
320     } //-- void setDescription(java.lang.String) 
321 
322     /***
323      * Sets the value of field 'executionPath'. The field
324      * 'executionPath' has the following description: This is the
325      * file path of the executable
326      * 
327      * @param executionPath the value of field 'executionPath'.
328      */
329     public void setExecutionPath(java.lang.String executionPath)
330     {
331         this._executionPath = executionPath;
332     } //-- void setExecutionPath(java.lang.String) 
333 
334     /***
335      * Sets the value of field 'longName'.
336      * 
337      * @param longName the value of field 'longName'.
338      */
339     public void setLongName(java.lang.String longName)
340     {
341         this._longName = longName;
342     } //-- void setLongName(java.lang.String) 
343 
344     /***
345      * Method setReferenceURL
346      * 
347      * @param index
348      * @param vReferenceURL
349      */
350     public void setReferenceURL(int index, java.lang.String vReferenceURL)
351         throws java.lang.IndexOutOfBoundsException
352     {
353         //-- check bounds for index
354         if ((index < 0) || (index > _referenceURLList.size())) {
355             throw new IndexOutOfBoundsException();
356         }
357         _referenceURLList.set(index, vReferenceURL);
358     } //-- void setReferenceURL(int, java.lang.String) 
359 
360     /***
361      * Method setReferenceURL
362      * 
363      * @param referenceURLArray
364      */
365     public void setReferenceURL(java.lang.String[] referenceURLArray)
366     {
367         //-- copy array
368         _referenceURLList.clear();
369         for (int i = 0; i < referenceURLArray.length; i++) {
370             _referenceURLList.add(referenceURLArray[i]);
371         }
372     } //-- void setReferenceURL(java.lang.String) 
373 
374     /***
375      * Sets the value of field 'version'. The field 'version' has
376      * the following description: this should probably be in the
377      * main schema somewhere...
378      * 
379      * @param version the value of field 'version'.
380      */
381     public void setVersion(java.lang.String version)
382     {
383         this._version = version;
384     } //-- void setVersion(java.lang.String) 
385 
386     /***
387      * Method unmarshalCommandLineApplication
388      * 
389      * @param reader
390      */
391     public static org.astrogrid.applications.beans.v1.cea.implementation.CommandLineApplication unmarshalCommandLineApplication(java.io.Reader reader)
392         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
393     {
394         return (org.astrogrid.applications.beans.v1.cea.implementation.CommandLineApplication) Unmarshaller.unmarshal(org.astrogrid.applications.beans.v1.cea.implementation.CommandLineApplication.class, reader);
395     } //-- org.astrogrid.applications.beans.v1.cea.implementation.CommandLineApplication unmarshalCommandLineApplication(java.io.Reader) 
396 
397     /***
398      * Method validate
399      */
400     public void validate()
401         throws org.exolab.castor.xml.ValidationException
402     {
403         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
404         validator.validate(this);
405     } //-- void validate() 
406 
407 }