1 7 8 package org.apache.jetspeed.xml.api.jcm; 9 10 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 28 public class Topics implements java.io.Serializable { 29 30 31 35 private java.util.Vector _entryList; 36 37 38 42 public Topics() { 43 super(); 44 _entryList = new Vector (); 45 } 47 48 52 56 public void addEntry(Entry vEntry) 57 throws java.lang.IndexOutOfBoundsException 58 { 59 _entryList.addElement(vEntry); 60 } 62 64 public java.util.Enumeration enumerateEntry() 65 { 66 return _entryList.elements(); 67 } 69 73 public Entry getEntry(int index) 74 throws java.lang.IndexOutOfBoundsException 75 { 76 if ((index < 0) || (index > _entryList.size())) { 78 throw new IndexOutOfBoundsException (); 79 } 80 81 return (Entry) _entryList.elementAt(index); 82 } 84 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 } 96 98 public int getEntryCount() 99 { 100 return _entryList.size(); 101 } 103 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 } 116 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 } 127 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 } 138 140 public void removeAllEntry() 141 { 142 _entryList.removeAllElements(); 143 } 145 149 public Entry removeEntry(int index) 150 { 151 Object obj = _entryList.elementAt(index); 152 _entryList.removeElementAt(index); 153 return (Entry) obj; 154 } 156 161 public void setEntry(int index, Entry vEntry) 162 throws java.lang.IndexOutOfBoundsException 163 { 164 if ((index < 0) || (index > _entryList.size())) { 166 throw new IndexOutOfBoundsException (); 167 } 168 _entryList.setElementAt(vEntry, index); 169 } 171 175 public void setEntry(Entry[] entryArray) 176 { 177 _entryList.removeAllElements(); 179 for (int i = 0; i < entryArray.length; i++) { 180 _entryList.addElement(entryArray[i]); 181 } 182 } 184 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 } 194 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 } 203 } 204 | Popular Tags |