View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package fr.in2p3.jsaga.adaptor.schema.job.emulator;
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   * Class Server.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class Server implements java.io.Serializable {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /**
39       * Field _host
40       */
41      private java.lang.String _host;
42  
43      /**
44       * Field _port
45       */
46      private int _port;
47  
48      /**
49       * keeps track of state for field: _port
50       */
51      private boolean _has_port;
52  
53      /**
54       * Field _jobList
55       */
56      private java.util.ArrayList _jobList;
57  
58  
59        //----------------/
60       //- Constructors -/
61      //----------------/
62  
63      public Server() 
64       {
65          super();
66          _jobList = new ArrayList();
67      } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.Server()
68  
69  
70        //-----------/
71       //- Methods -/
72      //-----------/
73  
74      /**
75       * Method addJob
76       * 
77       * 
78       * 
79       * @param vJob
80       */
81      public void addJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
82          throws java.lang.IndexOutOfBoundsException
83      {
84          _jobList.add(vJob);
85      } //-- void addJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) 
86  
87      /**
88       * Method addJob
89       * 
90       * 
91       * 
92       * @param index
93       * @param vJob
94       */
95      public void addJob(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
96          throws java.lang.IndexOutOfBoundsException
97      {
98          _jobList.add(index, vJob);
99      } //-- void addJob(int, fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) 
100 
101     /**
102      * Method clearJob
103      * 
104      */
105     public void clearJob()
106     {
107         _jobList.clear();
108     } //-- void clearJob() 
109 
110     /**
111      * Method deletePort
112      * 
113      */
114     public void deletePort()
115     {
116         this._has_port= false;
117     } //-- void deletePort() 
118 
119     /**
120      * Method enumerateJob
121      * 
122      * 
123      * 
124      * @return Enumeration
125      */
126     public java.util.Enumeration enumerateJob()
127     {
128         return new org.exolab.castor.util.IteratorEnumeration(_jobList.iterator());
129     } //-- java.util.Enumeration enumerateJob() 
130 
131     /**
132      * Returns the value of field 'host'.
133      * 
134      * @return String
135      * @return the value of field 'host'.
136      */
137     public java.lang.String getHost()
138     {
139         return this._host;
140     } //-- java.lang.String getHost() 
141 
142     /**
143      * Method getJob
144      * 
145      * 
146      * 
147      * @param index
148      * @return Job
149      */
150     public fr.in2p3.jsaga.adaptor.schema.job.emulator.Job getJob(int index)
151         throws java.lang.IndexOutOfBoundsException
152     {
153         //-- check bounds for index
154         if ((index < 0) || (index > _jobList.size())) {
155             throw new IndexOutOfBoundsException();
156         }
157         
158         return (fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) _jobList.get(index);
159     } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.Job getJob(int) 
160 
161     /**
162      * Method getJob
163      * 
164      * 
165      * 
166      * @return Job
167      */
168     public fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] getJob()
169     {
170         int size = _jobList.size();
171         fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] mArray = new fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[size];
172         for (int index = 0; index < size; index++) {
173             mArray[index] = (fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) _jobList.get(index);
174         }
175         return mArray;
176     } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] getJob() 
177 
178     /**
179      * Method getJobCount
180      * 
181      * 
182      * 
183      * @return int
184      */
185     public int getJobCount()
186     {
187         return _jobList.size();
188     } //-- int getJobCount() 
189 
190     /**
191      * Returns the value of field 'port'.
192      * 
193      * @return int
194      * @return the value of field 'port'.
195      */
196     public int getPort()
197     {
198         return this._port;
199     } //-- int getPort() 
200 
201     /**
202      * Method hasPort
203      * 
204      * 
205      * 
206      * @return boolean
207      */
208     public boolean hasPort()
209     {
210         return this._has_port;
211     } //-- boolean hasPort() 
212 
213     /**
214      * Method isValid
215      * 
216      * 
217      * 
218      * @return boolean
219      */
220     public boolean isValid()
221     {
222         try {
223             validate();
224         }
225         catch (org.exolab.castor.xml.ValidationException vex) {
226             return false;
227         }
228         return true;
229     } //-- boolean isValid() 
230 
231     /**
232      * Method marshal
233      * 
234      * 
235      * 
236      * @param out
237      */
238     public void marshal(java.io.Writer out)
239         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
240     {
241         
242         Marshaller.marshal(this, out);
243     } //-- void marshal(java.io.Writer) 
244 
245     /**
246      * Method marshal
247      * 
248      * 
249      * 
250      * @param handler
251      */
252     public void marshal(org.xml.sax.ContentHandler handler)
253         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
254     {
255         
256         Marshaller.marshal(this, handler);
257     } //-- void marshal(org.xml.sax.ContentHandler) 
258 
259     /**
260      * Method removeJob
261      * 
262      * 
263      * 
264      * @param vJob
265      * @return boolean
266      */
267     public boolean removeJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
268     {
269         boolean removed = _jobList.remove(vJob);
270         return removed;
271     } //-- boolean removeJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) 
272 
273     /**
274      * Sets the value of field 'host'.
275      * 
276      * @param host the value of field 'host'.
277      */
278     public void setHost(java.lang.String host)
279     {
280         this._host = host;
281     } //-- void setHost(java.lang.String) 
282 
283     /**
284      * Method setJob
285      * 
286      * 
287      * 
288      * @param index
289      * @param vJob
290      */
291     public void setJob(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.Job vJob)
292         throws java.lang.IndexOutOfBoundsException
293     {
294         //-- check bounds for index
295         if ((index < 0) || (index > _jobList.size())) {
296             throw new IndexOutOfBoundsException();
297         }
298         _jobList.set(index, vJob);
299     } //-- void setJob(int, fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) 
300 
301     /**
302      * Method setJob
303      * 
304      * 
305      * 
306      * @param jobArray
307      */
308     public void setJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job[] jobArray)
309     {
310         //-- copy array
311         _jobList.clear();
312         for (int i = 0; i < jobArray.length; i++) {
313             _jobList.add(jobArray[i]);
314         }
315     } //-- void setJob(fr.in2p3.jsaga.adaptor.schema.job.emulator.Job) 
316 
317     /**
318      * Sets the value of field 'port'.
319      * 
320      * @param port the value of field 'port'.
321      */
322     public void setPort(int port)
323     {
324         this._port = port;
325         this._has_port = true;
326     } //-- void setPort(int) 
327 
328     /**
329      * Method unmarshal
330      * 
331      * 
332      * 
333      * @param reader
334      * @return Object
335      */
336     public static java.lang.Object unmarshal(java.io.Reader reader)
337         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
338     {
339         return (fr.in2p3.jsaga.adaptor.schema.job.emulator.Server) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.job.emulator.Server.class, reader);
340     } //-- java.lang.Object unmarshal(java.io.Reader) 
341 
342     /**
343      * Method validate
344      * 
345      */
346     public void validate()
347         throws org.exolab.castor.xml.ValidationException
348     {
349         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
350         validator.validate(this);
351     } //-- void validate() 
352 
353 }