1 /***
2 * JFoxSOAF, Service-Oriented Application Framework
3 *
4 * Copyright (C) www.huihoo.org
5 *
6 * Distributable under GNU LGPL For more information, please visit:
7 * http://www.huihoo.org/jfox/jfoxsoaf
8 */
9
10 package org.huihoo.jfox.soaf.schema.service;
11
12 import java.util.Vector;
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /***
18 * <p>
19 * Class ServiceEntry.
20 * </p>
21 *
22 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
23 * @version $Revision: 1.4 $ $Date: 2004/10/18 10:26:39 $
24 * @version Revision: 1.0
25 */
26
27 public class ServiceEntry implements java.io.Serializable,
28 org.huihoo.jfox.soaf.container.ServiceEntry {
29
30 /***
31 * Field _id
32 */
33 private java.lang.String _id;
34
35 /***
36 * Field _description
37 */
38 private java.lang.String _description;
39
40 /***
41 * Field _manageable
42 */
43 private java.lang.String _manageable;
44
45 /***
46 * Field _interface
47 */
48 private java.lang.String _interface;
49
50 /***
51 * Field _implementation
52 */
53 private java.lang.String _implementation;
54
55 /***
56 * Field _parameterList
57 */
58 private java.util.Vector _parameterList;
59
60 public ServiceEntry() {
61 super();
62 _parameterList = new Vector();
63 }
64
65 /***
66 * Method addParameter
67 *
68 * @param vParameter
69 */
70 public void addParameter(
71 org.huihoo.jfox.soaf.schema.service.Parameter vParameter)
72 throws java.lang.IndexOutOfBoundsException {
73 _parameterList.addElement(vParameter);
74 }
75
76 /***
77 * Method addParameter
78 *
79 * @param index
80 * @param vParameter
81 */
82 public void addParameter(int index,
83 org.huihoo.jfox.soaf.schema.service.Parameter vParameter)
84 throws java.lang.IndexOutOfBoundsException {
85 _parameterList.insertElementAt(vParameter, index);
86 }
87
88 /***
89 * Method enumerateParameter
90 */
91 public java.util.Enumeration enumerateParameter() {
92 return _parameterList.elements();
93 }
94
95 /***
96 * Method getDescriptionReturns the value of field 'description'.
97 *
98 * @return the value of field 'description'.
99 */
100 public java.lang.String getDescription() {
101 return this._description;
102 }
103
104 /***
105 * Method getIdReturns the value of field 'id'.
106 *
107 * @return the value of field 'id'.
108 */
109 public java.lang.String getId() {
110 return this._id;
111 }
112
113 /***
114 * Method getImplementationReturns the value of field 'implementation'.
115 *
116 * @return the value of field 'implementation'.
117 */
118 public java.lang.String getImplementation() {
119 return this._implementation;
120 }
121
122 /***
123 * Method getInterfaceReturns the value of field 'interface'.
124 *
125 * @return the value of field 'interface'.
126 */
127 public java.lang.String getInterface() {
128 return this._interface;
129 }
130
131 /***
132 * Method getManageableReturns the value of field 'manageable'.
133 *
134 * @return the value of field 'manageable'.
135 */
136 public java.lang.String getManageable() {
137 return this._manageable;
138 }
139
140 /***
141 * Method getParameter
142 *
143 * @param index
144 */
145 public org.huihoo.jfox.soaf.schema.service.Parameter getParameter(int index)
146 throws java.lang.IndexOutOfBoundsException {
147
148 if ((index < 0) || (index > _parameterList.size())) {
149 throw new IndexOutOfBoundsException();
150 }
151
152 return (org.huihoo.jfox.soaf.schema.service.Parameter) _parameterList
153 .elementAt(index);
154 }
155
156 /***
157 * Method getParameter
158 */
159 public org.huihoo.jfox.soaf.schema.service.Parameter[] getParameter() {
160 int size = _parameterList.size();
161 org.huihoo.jfox.soaf.schema.service.Parameter[] mArray = new org.huihoo.jfox.soaf.schema.service.Parameter[size];
162 for (int index = 0; index < size; index++) {
163 mArray[index] = (org.huihoo.jfox.soaf.schema.service.Parameter) _parameterList
164 .elementAt(index);
165 }
166 return mArray;
167 }
168
169 /***
170 * Method getParameterCount
171 */
172 public int getParameterCount() {
173 return _parameterList.size();
174 }
175
176 /***
177 * Method isValid
178 */
179 public boolean isValid() {
180 try {
181 validate();
182 } catch (org.exolab.castor.xml.ValidationException vex) {
183 return false;
184 }
185 return true;
186 }
187
188 /***
189 * Method marshal
190 *
191 * @param out
192 */
193 public void marshal(java.io.Writer out)
194 throws org.exolab.castor.xml.MarshalException,
195 org.exolab.castor.xml.ValidationException {
196
197 Marshaller.marshal(this, out);
198 }
199
200 /***
201 * Method marshal
202 *
203 * @param handler
204 */
205 public void marshal(org.xml.sax.ContentHandler handler)
206 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
207 org.exolab.castor.xml.ValidationException {
208
209 Marshaller.marshal(this, handler);
210 }
211
212 /***
213 * Method removeAllParameter
214 */
215 public void removeAllParameter() {
216 _parameterList.removeAllElements();
217 }
218
219 /***
220 * Method removeParameter
221 *
222 * @param index
223 */
224 public org.huihoo.jfox.soaf.schema.service.Parameter removeParameter(
225 int index) {
226 java.lang.Object obj = _parameterList.elementAt(index);
227 _parameterList.removeElementAt(index);
228 return (org.huihoo.jfox.soaf.schema.service.Parameter) obj;
229 }
230
231 /***
232 * Method setDescriptionSets the value of field 'description'.
233 *
234 * @param description
235 * the value of field 'description'.
236 */
237 public void setDescription(java.lang.String description) {
238 this._description = description;
239 }
240
241 /***
242 * Method setIdSets the value of field 'id'.
243 *
244 * @param id
245 * the value of field 'id'.
246 */
247 public void setId(java.lang.String id) {
248 this._id = id;
249 }
250
251 /***
252 * Method setImplementationSets the value of field 'implementation'.
253 *
254 * @param implementation
255 * the value of field 'implementation'.
256 */
257 public void setImplementation(java.lang.String implementation) {
258 this._implementation = implementation;
259 }
260
261 /***
262 * Method setInterfaceSets the value of field 'interface'.
263 *
264 * @param _interface
265 * @param interface
266 * the value of field 'interface'.
267 */
268 public void setInterface(java.lang.String _interface) {
269 this._interface = _interface;
270 }
271
272 /***
273 * Method setManageableSets the value of field 'manageable'.
274 *
275 * @param manageable
276 * the value of field 'manageable'.
277 */
278 public void setManageable(java.lang.String manageable) {
279 this._manageable = manageable;
280 }
281
282 /***
283 * Method setParameter
284 *
285 * @param index
286 * @param vParameter
287 */
288 public void setParameter(int index,
289 org.huihoo.jfox.soaf.schema.service.Parameter vParameter)
290 throws java.lang.IndexOutOfBoundsException {
291
292 if ((index < 0) || (index > _parameterList.size())) {
293 throw new IndexOutOfBoundsException();
294 }
295 _parameterList.setElementAt(vParameter, index);
296 }
297
298 /***
299 * Method setParameter
300 *
301 * @param parameterArray
302 */
303 public void setParameter(
304 org.huihoo.jfox.soaf.schema.service.Parameter[] parameterArray) {
305
306 _parameterList.removeAllElements();
307 for (int i = 0; i < parameterArray.length; i++) {
308 _parameterList.addElement(parameterArray[i]);
309 }
310 }
311
312 /***
313 * Method unmarshal
314 *
315 * @param reader
316 */
317 public static org.huihoo.jfox.soaf.schema.service.ServiceEntry unmarshal(
318 java.io.Reader reader)
319 throws org.exolab.castor.xml.MarshalException,
320 org.exolab.castor.xml.ValidationException {
321 return (org.huihoo.jfox.soaf.schema.service.ServiceEntry) Unmarshaller
322 .unmarshal(
323 org.huihoo.jfox.soaf.schema.service.ServiceEntry.class,
324 reader);
325 }
326
327 /***
328 * Method validate
329 */
330 public void validate() throws org.exolab.castor.xml.ValidationException {
331 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
332 validator.validate(this);
333 }
334
335 }