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