1
2
3
4
5
6
7
8 package org.astrogrid.applications.beans.v1;
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.applications.beans.v1.types.ApplicationKindType;
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 * Base Application Description
27 *
28 * @version $Revision: 1.26 $ $Date: 2007/01/04 16:26:34 $
29 */
30 public class ApplicationBase extends org.astrogrid.common.bean.BaseBean
31 implements java.io.Serializable
32 {
33
34
35
36
37
38
39 /***
40 * This is the name of an application - it consists of the
41 * authorityId and the resourceID. e.g. authority.id/name -
42 * This should probably really be the ivorn proper, but all the
43 * implementations at the moment leave the ivo:// part off the
44 * internal name of the application
45 */
46 private java.lang.String _name;
47
48 /***
49 * A Java class that implements
50 * org.astrogrid.applications.Application
51 */
52 private java.lang.String _instanceClass;
53
54 /***
55 * The CEA type of the application - this allows the system to
56 * determine which CEC it should be talking to.
57 */
58 private org.astrogrid.applications.beans.v1.types.ApplicationKindType _applicationType;
59
60 /***
61 * The complete list of parameters that might occur in any of
62 * the apllication interfaces
63 */
64 private org.astrogrid.applications.beans.v1.Parameters _parameters;
65
66 /***
67 * The list of interfaces that an application might have
68 */
69 private org.astrogrid.applications.beans.v1.InterfacesType _interfaces;
70
71
72
73
74
75
76 public ApplicationBase() {
77 super();
78 }
79
80
81
82
83
84
85 /***
86 * Note: hashCode() has not been overriden
87 *
88 * @param obj
89 */
90 public boolean equals(java.lang.Object obj)
91 {
92 if ( this == obj )
93 return true;
94
95 if (super.equals(obj)==false)
96 return false;
97
98 if (obj instanceof ApplicationBase) {
99
100 ApplicationBase temp = (ApplicationBase)obj;
101 if (this._name != null) {
102 if (temp._name == null) return false;
103 else if (!(this._name.equals(temp._name)))
104 return false;
105 }
106 else if (temp._name != null)
107 return false;
108 if (this._instanceClass != null) {
109 if (temp._instanceClass == null) return false;
110 else if (!(this._instanceClass.equals(temp._instanceClass)))
111 return false;
112 }
113 else if (temp._instanceClass != null)
114 return false;
115 if (this._applicationType != null) {
116 if (temp._applicationType == null) return false;
117 else if (!(this._applicationType.equals(temp._applicationType)))
118 return false;
119 }
120 else if (temp._applicationType != null)
121 return false;
122 if (this._parameters != null) {
123 if (temp._parameters == null) return false;
124 else if (!(this._parameters.equals(temp._parameters)))
125 return false;
126 }
127 else if (temp._parameters != null)
128 return false;
129 if (this._interfaces != null) {
130 if (temp._interfaces == null) return false;
131 else if (!(this._interfaces.equals(temp._interfaces)))
132 return false;
133 }
134 else if (temp._interfaces != null)
135 return false;
136 return true;
137 }
138 return false;
139 }
140
141 /***
142 * Returns the value of field 'applicationType'. The field
143 * 'applicationType' has the following description: The CEA
144 * type of the application - this allows the system to
145 * determine which CEC it should be talking to.
146 *
147 * @return the value of field 'applicationType'.
148 */
149 public org.astrogrid.applications.beans.v1.types.ApplicationKindType getApplicationType()
150 {
151 return this._applicationType;
152 }
153
154 /***
155 * Returns the value of field 'instanceClass'. The field
156 * 'instanceClass' has the following description: A Java class
157 * that implements org.astrogrid.applications.Application
158 *
159 * @return the value of field 'instanceClass'.
160 */
161 public java.lang.String getInstanceClass()
162 {
163 return this._instanceClass;
164 }
165
166 /***
167 * Returns the value of field 'interfaces'. The field
168 * 'interfaces' has the following description: The list of
169 * interfaces that an application might have
170 *
171 * @return the value of field 'interfaces'.
172 */
173 public org.astrogrid.applications.beans.v1.InterfacesType getInterfaces()
174 {
175 return this._interfaces;
176 }
177
178 /***
179 * Returns the value of field 'name'. The field 'name' has the
180 * following description: This is the name of an application -
181 * it consists of the authorityId and the resourceID. e.g.
182 * authority.id/name - This should probably really be the ivorn
183 * proper, but all the implementations at the moment leave the
184 * ivo:// part off the internal name of the application
185 *
186 * @return the value of field 'name'.
187 */
188 public java.lang.String getName()
189 {
190 return this._name;
191 }
192
193 /***
194 * Returns the value of field 'parameters'. The field
195 * 'parameters' has the following description: The complete
196 * list of parameters that might occur in any of the
197 * apllication interfaces
198 *
199 * @return the value of field 'parameters'.
200 */
201 public org.astrogrid.applications.beans.v1.Parameters getParameters()
202 {
203 return this._parameters;
204 }
205
206 /***
207 * Method isValid
208 */
209 public boolean isValid()
210 {
211 try {
212 validate();
213 }
214 catch (org.exolab.castor.xml.ValidationException vex) {
215 return false;
216 }
217 return true;
218 }
219
220 /***
221 * Method marshal
222 *
223 * @param out
224 */
225 public void marshal(java.io.Writer out)
226 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
227 {
228
229 Marshaller.marshal(this, out);
230 }
231
232 /***
233 * Method marshal
234 *
235 * @param handler
236 */
237 public void marshal(org.xml.sax.ContentHandler handler)
238 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
239 {
240
241 Marshaller.marshal(this, handler);
242 }
243
244 /***
245 * Sets the value of field 'applicationType'. The field
246 * 'applicationType' has the following description: The CEA
247 * type of the application - this allows the system to
248 * determine which CEC it should be talking to.
249 *
250 * @param applicationType the value of field 'applicationType'.
251 */
252 public void setApplicationType(org.astrogrid.applications.beans.v1.types.ApplicationKindType applicationType)
253 {
254 this._applicationType = applicationType;
255 }
256
257 /***
258 * Sets the value of field 'instanceClass'. The field
259 * 'instanceClass' has the following description: A Java class
260 * that implements org.astrogrid.applications.Application
261 *
262 * @param instanceClass the value of field 'instanceClass'.
263 */
264 public void setInstanceClass(java.lang.String instanceClass)
265 {
266 this._instanceClass = instanceClass;
267 }
268
269 /***
270 * Sets the value of field 'interfaces'. The field 'interfaces'
271 * has the following description: The list of interfaces that
272 * an application might have
273 *
274 * @param interfaces the value of field 'interfaces'.
275 */
276 public void setInterfaces(org.astrogrid.applications.beans.v1.InterfacesType interfaces)
277 {
278 this._interfaces = interfaces;
279 }
280
281 /***
282 * Sets the value of field 'name'. The field 'name' has the
283 * following description: This is the name of an application -
284 * it consists of the authorityId and the resourceID. e.g.
285 * authority.id/name - This should probably really be the ivorn
286 * proper, but all the implementations at the moment leave the
287 * ivo:// part off the internal name of the application
288 *
289 * @param name the value of field 'name'.
290 */
291 public void setName(java.lang.String name)
292 {
293 this._name = name;
294 }
295
296 /***
297 * Sets the value of field 'parameters'. The field 'parameters'
298 * has the following description: The complete list of
299 * parameters that might occur in any of the apllication
300 * interfaces
301 *
302 * @param parameters the value of field 'parameters'.
303 */
304 public void setParameters(org.astrogrid.applications.beans.v1.Parameters parameters)
305 {
306 this._parameters = parameters;
307 }
308
309 /***
310 * Method unmarshalApplicationBase
311 *
312 * @param reader
313 */
314 public static org.astrogrid.applications.beans.v1.ApplicationBase unmarshalApplicationBase(java.io.Reader reader)
315 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
316 {
317 return (org.astrogrid.applications.beans.v1.ApplicationBase) Unmarshaller.unmarshal(org.astrogrid.applications.beans.v1.ApplicationBase.class, reader);
318 }
319
320 /***
321 * Method validate
322 */
323 public void validate()
324 throws org.exolab.castor.xml.ValidationException
325 {
326 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
327 validator.validate(this);
328 }
329
330 }