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.config;
11
12 import java.util.Vector;
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /***
18 * Class SystemInterceptor.
19 *
20 * @version $Revision: 1.1 $ $Date: 2004/10/13 10:52:06 $
21 */
22 public class SystemInterceptor implements java.io.Serializable {
23
24 /***
25 * Field _interceptorList
26 */
27 private java.util.Vector _interceptorList;
28
29 public SystemInterceptor() {
30 super();
31 _interceptorList = new Vector();
32 }
33
34 /***
35 * Method addInterceptor
36 *
37 * @param vInterceptor
38 */
39 public void addInterceptor(
40 org.huihoo.jfox.soaf.schema.config.Interceptor vInterceptor)
41 throws java.lang.IndexOutOfBoundsException {
42 _interceptorList.addElement(vInterceptor);
43 }
44
45 /***
46 * Method addInterceptor
47 *
48 * @param index
49 * @param vInterceptor
50 */
51 public void addInterceptor(int index,
52 org.huihoo.jfox.soaf.schema.config.Interceptor vInterceptor)
53 throws java.lang.IndexOutOfBoundsException {
54 _interceptorList.insertElementAt(vInterceptor, index);
55 }
56
57 /***
58 * Method enumerateInterceptor
59 */
60 public java.util.Enumeration enumerateInterceptor() {
61 return _interceptorList.elements();
62 }
63
64 /***
65 * Method getInterceptor
66 *
67 * @param index
68 */
69 public org.huihoo.jfox.soaf.schema.config.Interceptor getInterceptor(
70 int index) throws java.lang.IndexOutOfBoundsException {
71
72 if ((index < 0) || (index > _interceptorList.size())) {
73 throw new IndexOutOfBoundsException();
74 }
75
76 return (org.huihoo.jfox.soaf.schema.config.Interceptor) _interceptorList
77 .elementAt(index);
78 }
79
80 /***
81 * Method getInterceptor
82 */
83 public org.huihoo.jfox.soaf.schema.config.Interceptor[] getInterceptor() {
84 int size = _interceptorList.size();
85 org.huihoo.jfox.soaf.schema.config.Interceptor[] mArray = new org.huihoo.jfox.soaf.schema.config.Interceptor[size];
86 for (int index = 0; index < size; index++) {
87 mArray[index] = (org.huihoo.jfox.soaf.schema.config.Interceptor) _interceptorList
88 .elementAt(index);
89 }
90 return mArray;
91 }
92
93 /***
94 * Method getInterceptorCount
95 */
96 public int getInterceptorCount() {
97 return _interceptorList.size();
98 }
99
100 /***
101 * Method isValid
102 */
103 public boolean isValid() {
104 try {
105 validate();
106 } catch (org.exolab.castor.xml.ValidationException vex) {
107 return false;
108 }
109 return true;
110 }
111
112 /***
113 * Method marshal
114 *
115 * @param out
116 */
117 public void marshal(java.io.Writer out)
118 throws org.exolab.castor.xml.MarshalException,
119 org.exolab.castor.xml.ValidationException {
120
121 Marshaller.marshal(this, out);
122 }
123
124 /***
125 * Method marshal
126 *
127 * @param handler
128 */
129 public void marshal(org.xml.sax.ContentHandler handler)
130 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
131 org.exolab.castor.xml.ValidationException {
132
133 Marshaller.marshal(this, handler);
134 }
135
136 /***
137 * Method removeAllInterceptor
138 */
139 public void removeAllInterceptor() {
140 _interceptorList.removeAllElements();
141 }
142
143 /***
144 * Method removeInterceptor
145 *
146 * @param index
147 */
148 public org.huihoo.jfox.soaf.schema.config.Interceptor removeInterceptor(
149 int index) {
150 java.lang.Object obj = _interceptorList.elementAt(index);
151 _interceptorList.removeElementAt(index);
152 return (org.huihoo.jfox.soaf.schema.config.Interceptor) obj;
153 }
154
155 /***
156 * Method setInterceptor
157 *
158 * @param index
159 * @param vInterceptor
160 */
161 public void setInterceptor(int index,
162 org.huihoo.jfox.soaf.schema.config.Interceptor vInterceptor)
163 throws java.lang.IndexOutOfBoundsException {
164
165 if ((index < 0) || (index > _interceptorList.size())) {
166 throw new IndexOutOfBoundsException();
167 }
168 _interceptorList.setElementAt(vInterceptor, index);
169 }
170
171 /***
172 * Method setInterceptor
173 *
174 * @param interceptorArray
175 */
176 public void setInterceptor(
177 org.huihoo.jfox.soaf.schema.config.Interceptor[] interceptorArray) {
178
179 _interceptorList.removeAllElements();
180 for (int i = 0; i < interceptorArray.length; i++) {
181 _interceptorList.addElement(interceptorArray[i]);
182 }
183 }
184
185 /***
186 * Method unmarshal
187 *
188 * @param reader
189 */
190 public static org.huihoo.jfox.soaf.schema.config.SystemInterceptor unmarshal(
191 java.io.Reader reader)
192 throws org.exolab.castor.xml.MarshalException,
193 org.exolab.castor.xml.ValidationException {
194 return (org.huihoo.jfox.soaf.schema.config.SystemInterceptor) Unmarshaller
195 .unmarshal(
196 org.huihoo.jfox.soaf.schema.config.SystemInterceptor.class,
197 reader);
198 }
199
200 /***
201 * Method validate
202 */
203 public void validate() throws org.exolab.castor.xml.ValidationException {
204 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
205 validator.validate(this);
206 }
207
208 }