1
2
3
4
5
6
7
8 package org.apache.jetspeed.xml.api.jcm;
9
10
11
12
13
14 import java.io.Reader;
15 import java.io.Serializable;
16 import java.io.Writer;
17 import java.util.Enumeration;
18 import java.util.Vector;
19 import org.exolab.castor.xml.*;
20 import org.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.DocumentHandler;
23
24 /***
25 *
26 * @version $Revision$ $Date$
27 **/
28 public class Topics implements java.io.Serializable {
29
30
31
32
33
34
35 private java.util.Vector _entryList;
36
37
38
39
40
41
42 public Topics() {
43 super();
44 _entryList = new Vector();
45 }
46
47
48
49
50
51
52 /***
53 *
54 * @param vEntry
55 **/
56 public void addEntry(Entry vEntry)
57 throws java.lang.IndexOutOfBoundsException
58 {
59 _entryList.addElement(vEntry);
60 }
61
62 /***
63 **/
64 public java.util.Enumeration enumerateEntry()
65 {
66 return _entryList.elements();
67 }
68
69 /***
70 *
71 * @param index
72 **/
73 public Entry getEntry(int index)
74 throws java.lang.IndexOutOfBoundsException
75 {
76
77 if ((index < 0) || (index > _entryList.size())) {
78 throw new IndexOutOfBoundsException();
79 }
80
81 return (Entry) _entryList.elementAt(index);
82 }
83
84 /***
85 **/
86 public Entry[] getEntry()
87 {
88 int size = _entryList.size();
89 Entry[] mArray = new Entry[size];
90 for (int index = 0; index < size; index++) {
91 mArray[index] = (Entry) _entryList.elementAt(index);
92 }
93 return mArray;
94 }
95
96 /***
97 **/
98 public int getEntryCount()
99 {
100 return _entryList.size();
101 }
102
103 /***
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 *
118 * @param out
119 **/
120 public void marshal(java.io.Writer out)
121 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
122 {
123
124 Marshaller.marshal(this, out);
125 }
126
127 /***
128 *
129 * @param handler
130 **/
131 public void marshal(org.xml.sax.DocumentHandler handler)
132 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
133 {
134
135 Marshaller.marshal(this, handler);
136 }
137
138 /***
139 **/
140 public void removeAllEntry()
141 {
142 _entryList.removeAllElements();
143 }
144
145 /***
146 *
147 * @param index
148 **/
149 public Entry removeEntry(int index)
150 {
151 Object obj = _entryList.elementAt(index);
152 _entryList.removeElementAt(index);
153 return (Entry) obj;
154 }
155
156 /***
157 *
158 * @param index
159 * @param vEntry
160 **/
161 public void setEntry(int index, Entry vEntry)
162 throws java.lang.IndexOutOfBoundsException
163 {
164
165 if ((index < 0) || (index > _entryList.size())) {
166 throw new IndexOutOfBoundsException();
167 }
168 _entryList.setElementAt(vEntry, index);
169 }
170
171 /***
172 *
173 * @param entryArray
174 **/
175 public void setEntry(Entry[] entryArray)
176 {
177
178 _entryList.removeAllElements();
179 for (int i = 0; i < entryArray.length; i++) {
180 _entryList.addElement(entryArray[i]);
181 }
182 }
183
184 /***
185 *
186 * @param reader
187 **/
188 public static org.apache.jetspeed.xml.api.jcm.Topics unmarshal(java.io.Reader reader)
189 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
190 {
191 return (org.apache.jetspeed.xml.api.jcm.Topics) Unmarshaller.unmarshal(org.apache.jetspeed.xml.api.jcm.Topics.class, reader);
192 }
193
194 /***
195 **/
196 public void validate()
197 throws org.exolab.castor.xml.ValidationException
198 {
199 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
200 validator.validate(this);
201 }
202
203 }