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.config;
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 JobEmulatorConfig.
28   * 
29   * @version $Revision$ $Date$
30   */
31  public class JobEmulatorConfig implements java.io.Serializable {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /**
39       * Field _serverList
40       */
41      private java.util.ArrayList _serverList;
42  
43  
44        //----------------/
45       //- Constructors -/
46      //----------------/
47  
48      public JobEmulatorConfig() 
49       {
50          super();
51          _serverList = new ArrayList();
52      } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.config.JobEmulatorConfig()
53  
54  
55        //-----------/
56       //- Methods -/
57      //-----------/
58  
59      /**
60       * Method addServer
61       * 
62       * 
63       * 
64       * @param vServer
65       */
66      public void addServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server vServer)
67          throws java.lang.IndexOutOfBoundsException
68      {
69          _serverList.add(vServer);
70      } //-- void addServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) 
71  
72      /**
73       * Method addServer
74       * 
75       * 
76       * 
77       * @param index
78       * @param vServer
79       */
80      public void addServer(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server vServer)
81          throws java.lang.IndexOutOfBoundsException
82      {
83          _serverList.add(index, vServer);
84      } //-- void addServer(int, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) 
85  
86      /**
87       * Method clearServer
88       * 
89       */
90      public void clearServer()
91      {
92          _serverList.clear();
93      } //-- void clearServer() 
94  
95      /**
96       * Method enumerateServer
97       * 
98       * 
99       * 
100      * @return Enumeration
101      */
102     public java.util.Enumeration enumerateServer()
103     {
104         return new org.exolab.castor.util.IteratorEnumeration(_serverList.iterator());
105     } //-- java.util.Enumeration enumerateServer() 
106 
107     /**
108      * Method getServer
109      * 
110      * 
111      * 
112      * @param index
113      * @return Server
114      */
115     public fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server getServer(int index)
116         throws java.lang.IndexOutOfBoundsException
117     {
118         //-- check bounds for index
119         if ((index < 0) || (index > _serverList.size())) {
120             throw new IndexOutOfBoundsException();
121         }
122         
123         return (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) _serverList.get(index);
124     } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server getServer(int) 
125 
126     /**
127      * Method getServer
128      * 
129      * 
130      * 
131      * @return Server
132      */
133     public fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server[] getServer()
134     {
135         int size = _serverList.size();
136         fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server[] mArray = new fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server[size];
137         for (int index = 0; index < size; index++) {
138             mArray[index] = (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) _serverList.get(index);
139         }
140         return mArray;
141     } //-- fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server[] getServer() 
142 
143     /**
144      * Method getServerCount
145      * 
146      * 
147      * 
148      * @return int
149      */
150     public int getServerCount()
151     {
152         return _serverList.size();
153     } //-- int getServerCount() 
154 
155     /**
156      * Method isValid
157      * 
158      * 
159      * 
160      * @return boolean
161      */
162     public boolean isValid()
163     {
164         try {
165             validate();
166         }
167         catch (org.exolab.castor.xml.ValidationException vex) {
168             return false;
169         }
170         return true;
171     } //-- boolean isValid() 
172 
173     /**
174      * Method marshal
175      * 
176      * 
177      * 
178      * @param out
179      */
180     public void marshal(java.io.Writer out)
181         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
182     {
183         
184         Marshaller.marshal(this, out);
185     } //-- void marshal(java.io.Writer) 
186 
187     /**
188      * Method marshal
189      * 
190      * 
191      * 
192      * @param handler
193      */
194     public void marshal(org.xml.sax.ContentHandler handler)
195         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
196     {
197         
198         Marshaller.marshal(this, handler);
199     } //-- void marshal(org.xml.sax.ContentHandler) 
200 
201     /**
202      * Method removeServer
203      * 
204      * 
205      * 
206      * @param vServer
207      * @return boolean
208      */
209     public boolean removeServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server vServer)
210     {
211         boolean removed = _serverList.remove(vServer);
212         return removed;
213     } //-- boolean removeServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) 
214 
215     /**
216      * Method setServer
217      * 
218      * 
219      * 
220      * @param index
221      * @param vServer
222      */
223     public void setServer(int index, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server vServer)
224         throws java.lang.IndexOutOfBoundsException
225     {
226         //-- check bounds for index
227         if ((index < 0) || (index > _serverList.size())) {
228             throw new IndexOutOfBoundsException();
229         }
230         _serverList.set(index, vServer);
231     } //-- void setServer(int, fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) 
232 
233     /**
234      * Method setServer
235      * 
236      * 
237      * 
238      * @param serverArray
239      */
240     public void setServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server[] serverArray)
241     {
242         //-- copy array
243         _serverList.clear();
244         for (int i = 0; i < serverArray.length; i++) {
245             _serverList.add(serverArray[i]);
246         }
247     } //-- void setServer(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.Server) 
248 
249     /**
250      * Method unmarshal
251      * 
252      * 
253      * 
254      * @param reader
255      * @return Object
256      */
257     public static java.lang.Object unmarshal(java.io.Reader reader)
258         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
259     {
260         return (fr.in2p3.jsaga.adaptor.schema.job.emulator.config.JobEmulatorConfig) Unmarshaller.unmarshal(fr.in2p3.jsaga.adaptor.schema.job.emulator.config.JobEmulatorConfig.class, reader);
261     } //-- java.lang.Object unmarshal(java.io.Reader) 
262 
263     /**
264      * Method validate
265      * 
266      */
267     public void validate()
268         throws org.exolab.castor.xml.ValidationException
269     {
270         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
271         validator.validate(this);
272     } //-- void validate() 
273 
274 }