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: VOResource.java,v 1.14 2007/01/04 16:26:23 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.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 org.exolab.castor.xml.MarshalException;
19  import org.exolab.castor.xml.Marshaller;
20  import org.exolab.castor.xml.Unmarshaller;
21  import org.exolab.castor.xml.ValidationException;
22  import org.xml.sax.ContentHandler;
23  
24  /***
25   * A description of a single VO Resource
26   *  
27   *  This element is used as a general container for a single
28   * resource
29   *  descriptions and can be used as a root element. 
30   *  
31   * 
32   * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:23 $
33   */
34  public class VOResource extends org.astrogrid.common.bean.BaseBean 
35  implements java.io.Serializable
36  {
37  
38  
39        //--------------------------/
40       //- Class/Member Variables -/
41      //--------------------------/
42  
43      /***
44       * Any entity that is describable and identifiable by a IVOA
45       * Identifier.
46       *  
47       */
48      private org.astrogrid.registry.beans.resource.ResourceType _resource;
49  
50  
51        //----------------/
52       //- Constructors -/
53      //----------------/
54  
55      public VOResource() {
56          super();
57      } //-- org.astrogrid.registry.beans.resource.VOResource()
58  
59  
60        //-----------/
61       //- Methods -/
62      //-----------/
63  
64      /***
65       * Note: hashCode() has not been overriden
66       * 
67       * @param obj
68       */
69      public boolean equals(java.lang.Object obj)
70      {
71          if ( this == obj )
72              return true;
73          
74          if (super.equals(obj)==false)
75              return false;
76          
77          if (obj instanceof VOResource) {
78          
79              VOResource temp = (VOResource)obj;
80              if (this._resource != null) {
81                  if (temp._resource == null) return false;
82                  else if (!(this._resource.equals(temp._resource))) 
83                      return false;
84              }
85              else if (temp._resource != null)
86                  return false;
87              return true;
88          }
89          return false;
90      } //-- boolean equals(java.lang.Object) 
91  
92      /***
93       * Returns the value of field 'resource'. The field 'resource'
94       * has the following description: Any entity that is
95       * describable and identifiable by a IVOA Identifier.
96       *  
97       * 
98       * @return the value of field 'resource'.
99       */
100     public org.astrogrid.registry.beans.resource.ResourceType getResource()
101     {
102         return this._resource;
103     } //-- org.astrogrid.registry.beans.resource.ResourceType getResource() 
104 
105     /***
106      * Method isValid
107      */
108     public boolean isValid()
109     {
110         try {
111             validate();
112         }
113         catch (org.exolab.castor.xml.ValidationException vex) {
114             return false;
115         }
116         return true;
117     } //-- boolean isValid() 
118 
119     /***
120      * Method marshal
121      * 
122      * @param out
123      */
124     public void marshal(java.io.Writer out)
125         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
126     {
127         
128         Marshaller.marshal(this, out);
129     } //-- void marshal(java.io.Writer) 
130 
131     /***
132      * Method marshal
133      * 
134      * @param handler
135      */
136     public void marshal(org.xml.sax.ContentHandler handler)
137         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
138     {
139         
140         Marshaller.marshal(this, handler);
141     } //-- void marshal(org.xml.sax.ContentHandler) 
142 
143     /***
144      * Sets the value of field 'resource'. The field 'resource' has
145      * the following description: Any entity that is describable
146      * and identifiable by a IVOA Identifier.
147      *  
148      * 
149      * @param resource the value of field 'resource'.
150      */
151     public void setResource(org.astrogrid.registry.beans.resource.ResourceType resource)
152     {
153         this._resource = resource;
154     } //-- void setResource(org.astrogrid.registry.beans.resource.ResourceType) 
155 
156     /***
157      * Method unmarshalVOResource
158      * 
159      * @param reader
160      */
161     public static org.astrogrid.registry.beans.resource.VOResource unmarshalVOResource(java.io.Reader reader)
162         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
163     {
164         return (org.astrogrid.registry.beans.resource.VOResource) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.VOResource.class, reader);
165     } //-- org.astrogrid.registry.beans.resource.VOResource unmarshalVOResource(java.io.Reader) 
166 
167     /***
168      * Method validate
169      */
170     public void validate()
171         throws org.exolab.castor.xml.ValidationException
172     {
173         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
174         validator.validate(this);
175     } //-- void validate() 
176 
177 }