1
2
3
4
5
6
7
8 package org.astrogrid.workflow.beans.v1.execution;
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.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 string 'buffer' for holding further information, keyed by
26 * attribute - so execution record becomes a map.
27 *
28 * @version $Revision: 1.13 $ $Date: 2007/01/04 16:26:08 $
29 */
30 public class Extension extends org.astrogrid.common.bean.BaseBean
31 implements java.io.Serializable
32 {
33
34
35
36
37
38
39 /***
40 * internal content storage
41 */
42 private java.lang.String _content = "";
43
44 /***
45 * key to be used to retreive this extension buffer
46 */
47 private java.lang.String _key;
48
49
50
51
52
53
54 public Extension() {
55 super();
56 setContent("");
57 }
58
59
60
61
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 Extension) {
78
79 Extension temp = (Extension)obj;
80 if (this._content != null) {
81 if (temp._content == null) return false;
82 else if (!(this._content.equals(temp._content)))
83 return false;
84 }
85 else if (temp._content != null)
86 return false;
87 if (this._key != null) {
88 if (temp._key == null) return false;
89 else if (!(this._key.equals(temp._key)))
90 return false;
91 }
92 else if (temp._key != null)
93 return false;
94 return true;
95 }
96 return false;
97 }
98
99 /***
100 * Returns the value of field 'content'. The field 'content'
101 * has the following description: internal content storage
102 *
103 * @return the value of field 'content'.
104 */
105 public java.lang.String getContent()
106 {
107 return this._content;
108 }
109
110 /***
111 * Returns the value of field 'key'. The field 'key' has the
112 * following description: key to be used to retreive this
113 * extension buffer
114 *
115 * @return the value of field 'key'.
116 */
117 public java.lang.String getKey()
118 {
119 return this._key;
120 }
121
122 /***
123 * Method isValid
124 */
125 public boolean isValid()
126 {
127 try {
128 validate();
129 }
130 catch (org.exolab.castor.xml.ValidationException vex) {
131 return false;
132 }
133 return true;
134 }
135
136 /***
137 * Method marshal
138 *
139 * @param out
140 */
141 public void marshal(java.io.Writer out)
142 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
143 {
144
145 Marshaller.marshal(this, out);
146 }
147
148 /***
149 * Method marshal
150 *
151 * @param handler
152 */
153 public void marshal(org.xml.sax.ContentHandler handler)
154 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
155 {
156
157 Marshaller.marshal(this, handler);
158 }
159
160 /***
161 * Sets the value of field 'content'. The field 'content' has
162 * the following description: internal content storage
163 *
164 * @param content the value of field 'content'.
165 */
166 public void setContent(java.lang.String content)
167 {
168 this._content = content;
169 }
170
171 /***
172 * Sets the value of field 'key'. The field 'key' has the
173 * following description: key to be used to retreive this
174 * extension buffer
175 *
176 * @param key the value of field 'key'.
177 */
178 public void setKey(java.lang.String key)
179 {
180 this._key = key;
181 }
182
183 /***
184 * Method unmarshalExtension
185 *
186 * @param reader
187 */
188 public static org.astrogrid.workflow.beans.v1.execution.Extension unmarshalExtension(java.io.Reader reader)
189 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
190 {
191 return (org.astrogrid.workflow.beans.v1.execution.Extension) Unmarshaller.unmarshal(org.astrogrid.workflow.beans.v1.execution.Extension.class, reader);
192 }
193
194 /***
195 * Method validate
196 */
197 public void validate()
198 throws org.exolab.castor.xml.ValidationException
199 {
200 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
201 validator.validate(this);
202 }
203
204 }