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: RegistryType.java,v 1.14 2007/01/04 16:26:31 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.resource.registry;
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 RegistryType.
28   * 
29   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:31 $
30   */
31  public class RegistryType extends org.astrogrid.registry.beans.resource.ServiceType 
32  implements java.io.Serializable
33  {
34  
35  
36        //--------------------------/
37       //- Class/Member Variables -/
38      //--------------------------/
39  
40      /***
41       * an authority identifier managed by a registry.
42       *  
43       */
44      private java.util.ArrayList _managedAuthorityList;
45  
46  
47        //----------------/
48       //- Constructors -/
49      //----------------/
50  
51      public RegistryType() {
52          super();
53          _managedAuthorityList = new ArrayList();
54      } //-- org.astrogrid.registry.beans.resource.registry.RegistryType()
55  
56  
57        //-----------/
58       //- Methods -/
59      //-----------/
60  
61      /***
62       * Method addManagedAuthority
63       * 
64       * @param vManagedAuthority
65       */
66      public void addManagedAuthority(java.lang.String vManagedAuthority)
67          throws java.lang.IndexOutOfBoundsException
68      {
69          _managedAuthorityList.add(vManagedAuthority);
70      } //-- void addManagedAuthority(java.lang.String) 
71  
72      /***
73       * Method addManagedAuthority
74       * 
75       * @param index
76       * @param vManagedAuthority
77       */
78      public void addManagedAuthority(int index, java.lang.String vManagedAuthority)
79          throws java.lang.IndexOutOfBoundsException
80      {
81          _managedAuthorityList.add(index, vManagedAuthority);
82      } //-- void addManagedAuthority(int, java.lang.String) 
83  
84      /***
85       * Method clearManagedAuthority
86       */
87      public void clearManagedAuthority()
88      {
89          _managedAuthorityList.clear();
90      } //-- void clearManagedAuthority() 
91  
92      /***
93       * Method enumerateManagedAuthority
94       */
95      public java.util.Enumeration enumerateManagedAuthority()
96      {
97          return new org.exolab.castor.util.IteratorEnumeration(_managedAuthorityList.iterator());
98      } //-- java.util.Enumeration enumerateManagedAuthority() 
99  
100     /***
101      * Note: hashCode() has not been overriden
102      * 
103      * @param obj
104      */
105     public boolean equals(java.lang.Object obj)
106     {
107         if ( this == obj )
108             return true;
109         
110         if (super.equals(obj)==false)
111             return false;
112         
113         if (obj instanceof RegistryType) {
114         
115             RegistryType temp = (RegistryType)obj;
116             if (this._managedAuthorityList != null) {
117                 if (temp._managedAuthorityList == null) return false;
118                 else if (!(this._managedAuthorityList.equals(temp._managedAuthorityList))) 
119                     return false;
120             }
121             else if (temp._managedAuthorityList != null)
122                 return false;
123             return true;
124         }
125         return false;
126     } //-- boolean equals(java.lang.Object) 
127 
128     /***
129      * Method getManagedAuthority
130      * 
131      * @param index
132      */
133     public java.lang.String getManagedAuthority(int index)
134         throws java.lang.IndexOutOfBoundsException
135     {
136         //-- check bounds for index
137         if ((index < 0) || (index > _managedAuthorityList.size())) {
138             throw new IndexOutOfBoundsException();
139         }
140         
141         return (String)_managedAuthorityList.get(index);
142     } //-- java.lang.String getManagedAuthority(int) 
143 
144     /***
145      * Method getManagedAuthority
146      */
147     public java.lang.String[] getManagedAuthority()
148     {
149         int size = _managedAuthorityList.size();
150         java.lang.String[] mArray = new java.lang.String[size];
151         for (int index = 0; index < size; index++) {
152             mArray[index] = (String)_managedAuthorityList.get(index);
153         }
154         return mArray;
155     } //-- java.lang.String[] getManagedAuthority() 
156 
157     /***
158      * Method getManagedAuthorityCount
159      */
160     public int getManagedAuthorityCount()
161     {
162         return _managedAuthorityList.size();
163     } //-- int getManagedAuthorityCount() 
164 
165     /***
166      * Method isValid
167      */
168     public boolean isValid()
169     {
170         try {
171             validate();
172         }
173         catch (org.exolab.castor.xml.ValidationException vex) {
174             return false;
175         }
176         return true;
177     } //-- boolean isValid() 
178 
179     /***
180      * Method marshal
181      * 
182      * @param out
183      */
184     public void marshal(java.io.Writer out)
185         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
186     {
187         
188         Marshaller.marshal(this, out);
189     } //-- void marshal(java.io.Writer) 
190 
191     /***
192      * Method marshal
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 removeManagedAuthority
205      * 
206      * @param vManagedAuthority
207      */
208     public boolean removeManagedAuthority(java.lang.String vManagedAuthority)
209     {
210         boolean removed = _managedAuthorityList.remove(vManagedAuthority);
211         return removed;
212     } //-- boolean removeManagedAuthority(java.lang.String) 
213 
214     /***
215      * Method setManagedAuthority
216      * 
217      * @param index
218      * @param vManagedAuthority
219      */
220     public void setManagedAuthority(int index, java.lang.String vManagedAuthority)
221         throws java.lang.IndexOutOfBoundsException
222     {
223         //-- check bounds for index
224         if ((index < 0) || (index > _managedAuthorityList.size())) {
225             throw new IndexOutOfBoundsException();
226         }
227         _managedAuthorityList.set(index, vManagedAuthority);
228     } //-- void setManagedAuthority(int, java.lang.String) 
229 
230     /***
231      * Method setManagedAuthority
232      * 
233      * @param managedAuthorityArray
234      */
235     public void setManagedAuthority(java.lang.String[] managedAuthorityArray)
236     {
237         //-- copy array
238         _managedAuthorityList.clear();
239         for (int i = 0; i < managedAuthorityArray.length; i++) {
240             _managedAuthorityList.add(managedAuthorityArray[i]);
241         }
242     } //-- void setManagedAuthority(java.lang.String) 
243 
244     /***
245      * Method unmarshalRegistryType
246      * 
247      * @param reader
248      */
249     public static org.astrogrid.registry.beans.resource.registry.RegistryType unmarshalRegistryType(java.io.Reader reader)
250         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
251     {
252         return (org.astrogrid.registry.beans.resource.registry.RegistryType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.registry.RegistryType.class, reader);
253     } //-- org.astrogrid.registry.beans.resource.registry.RegistryType unmarshalRegistryType(java.io.Reader) 
254 
255     /***
256      * Method validate
257      */
258     public void validate()
259         throws org.exolab.castor.xml.ValidationException
260     {
261         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
262         validator.validate(this);
263     } //-- void validate() 
264 
265 }