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