1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.resource.registry;
9
10
11
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.astrogrid.registry.beans.v10.resource.ResourceName;
19 import org.exolab.castor.xml.MarshalException;
20 import org.exolab.castor.xml.Marshaller;
21 import org.exolab.castor.xml.Unmarshaller;
22 import org.exolab.castor.xml.ValidationException;
23 import org.xml.sax.ContentHandler;
24
25 /***
26 * a naming authority; an assertion of control over a
27 * namespace represented by an authority identifier.
28 *
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:34 $
31 */
32 public class Authority extends org.astrogrid.registry.beans.v10.resource.Resource
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * the organization that manages or owns the this authority.
43 *
44 */
45 private org.astrogrid.registry.beans.v10.resource.ResourceName _managingOrg;
46
47
48
49
50
51
52 public Authority() {
53 super();
54 }
55
56
57
58
59
60
61 /***
62 * Note: hashCode() has not been overriden
63 *
64 * @param obj
65 */
66 public boolean equals(java.lang.Object obj)
67 {
68 if ( this == obj )
69 return true;
70
71 if (super.equals(obj)==false)
72 return false;
73
74 if (obj instanceof Authority) {
75
76 Authority temp = (Authority)obj;
77 if (this._managingOrg != null) {
78 if (temp._managingOrg == null) return false;
79 else if (!(this._managingOrg.equals(temp._managingOrg)))
80 return false;
81 }
82 else if (temp._managingOrg != null)
83 return false;
84 return true;
85 }
86 return false;
87 }
88
89 /***
90 * Returns the value of field 'managingOrg'. The field
91 * 'managingOrg' has the following description: the
92 * organization that manages or owns the this authority.
93 *
94 *
95 * @return the value of field 'managingOrg'.
96 */
97 public org.astrogrid.registry.beans.v10.resource.ResourceName getManagingOrg()
98 {
99 return this._managingOrg;
100 }
101
102 /***
103 * Method isValid
104 */
105 public boolean isValid()
106 {
107 try {
108 validate();
109 }
110 catch (org.exolab.castor.xml.ValidationException vex) {
111 return false;
112 }
113 return true;
114 }
115
116 /***
117 * Method marshal
118 *
119 * @param out
120 */
121 public void marshal(java.io.Writer out)
122 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
123 {
124
125 Marshaller.marshal(this, out);
126 }
127
128 /***
129 * Method marshal
130 *
131 * @param handler
132 */
133 public void marshal(org.xml.sax.ContentHandler handler)
134 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
135 {
136
137 Marshaller.marshal(this, handler);
138 }
139
140 /***
141 * Sets the value of field 'managingOrg'. The field
142 * 'managingOrg' has the following description: the
143 * organization that manages or owns the this authority.
144 *
145 *
146 * @param managingOrg the value of field 'managingOrg'.
147 */
148 public void setManagingOrg(org.astrogrid.registry.beans.v10.resource.ResourceName managingOrg)
149 {
150 this._managingOrg = managingOrg;
151 }
152
153 /***
154 * Method unmarshalAuthority
155 *
156 * @param reader
157 */
158 public static org.astrogrid.registry.beans.v10.resource.registry.Authority unmarshalAuthority(java.io.Reader reader)
159 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
160 {
161 return (org.astrogrid.registry.beans.v10.resource.registry.Authority) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.registry.Authority.class, reader);
162 }
163
164 /***
165 * Method validate
166 */
167 public void validate()
168 throws org.exolab.castor.xml.ValidationException
169 {
170 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
171 validator.validate(this);
172 }
173
174 }