1 7 8 package org.openejb.alt.config.ejb11; 9 10 14 import java.io.IOException ; 15 import java.io.Reader ; 16 import java.io.Serializable ; 17 import java.io.Writer ; 18 import java.util.Enumeration ; 19 import java.util.Vector ; 20 import org.exolab.castor.xml.MarshalException; 21 import org.exolab.castor.xml.Marshaller; 22 import org.exolab.castor.xml.Unmarshaller; 23 import org.exolab.castor.xml.ValidationException; 24 import org.xml.sax.ContentHandler ; 25 26 31 public class OpenejbJar implements java.io.Serializable { 32 33 34 38 41 private java.util.Vector _ejbDeploymentList; 42 43 44 48 public OpenejbJar() { 49 super(); 50 _ejbDeploymentList = new Vector (); 51 } 53 54 58 63 public void addEjbDeployment(org.openejb.alt.config.ejb11.EjbDeployment vEjbDeployment) 64 throws java.lang.IndexOutOfBoundsException 65 { 66 _ejbDeploymentList.addElement(vEjbDeployment); 67 } 69 75 public void addEjbDeployment(int index, org.openejb.alt.config.ejb11.EjbDeployment vEjbDeployment) 76 throws java.lang.IndexOutOfBoundsException 77 { 78 _ejbDeploymentList.insertElementAt(vEjbDeployment, index); 79 } 81 84 public java.util.Enumeration enumerateEjbDeployment() 85 { 86 return _ejbDeploymentList.elements(); 87 } 89 94 public org.openejb.alt.config.ejb11.EjbDeployment getEjbDeployment(int index) 95 throws java.lang.IndexOutOfBoundsException 96 { 97 if ((index < 0) || (index > _ejbDeploymentList.size())) { 99 throw new IndexOutOfBoundsException (); 100 } 101 102 return (org.openejb.alt.config.ejb11.EjbDeployment) _ejbDeploymentList.elementAt(index); 103 } 105 108 public org.openejb.alt.config.ejb11.EjbDeployment[] getEjbDeployment() 109 { 110 int size = _ejbDeploymentList.size(); 111 org.openejb.alt.config.ejb11.EjbDeployment[] mArray = new org.openejb.alt.config.ejb11.EjbDeployment[size]; 112 for (int index = 0; index < size; index++) { 113 mArray[index] = (org.openejb.alt.config.ejb11.EjbDeployment) _ejbDeploymentList.elementAt(index); 114 } 115 return mArray; 116 } 118 121 public int getEjbDeploymentCount() 122 { 123 return _ejbDeploymentList.size(); 124 } 126 129 public boolean isValid() 130 { 131 try { 132 validate(); 133 } 134 catch (org.exolab.castor.xml.ValidationException vex) { 135 return false; 136 } 137 return true; 138 } 140 145 public void marshal(java.io.Writer out) 146 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 147 { 148 149 Marshaller.marshal(this, out); 150 } 152 157 public void marshal(org.xml.sax.ContentHandler handler) 158 throws java.io.IOException , org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 159 { 160 161 Marshaller.marshal(this, handler); 162 } 164 167 public void removeAllEjbDeployment() 168 { 169 _ejbDeploymentList.removeAllElements(); 170 } 172 177 public org.openejb.alt.config.ejb11.EjbDeployment removeEjbDeployment(int index) 178 { 179 java.lang.Object obj = _ejbDeploymentList.elementAt(index); 180 _ejbDeploymentList.removeElementAt(index); 181 return (org.openejb.alt.config.ejb11.EjbDeployment) obj; 182 } 184 190 public void setEjbDeployment(int index, org.openejb.alt.config.ejb11.EjbDeployment vEjbDeployment) 191 throws java.lang.IndexOutOfBoundsException 192 { 193 if ((index < 0) || (index > _ejbDeploymentList.size())) { 195 throw new IndexOutOfBoundsException (); 196 } 197 _ejbDeploymentList.setElementAt(vEjbDeployment, index); 198 } 200 205 public void setEjbDeployment(org.openejb.alt.config.ejb11.EjbDeployment[] ejbDeploymentArray) 206 { 207 _ejbDeploymentList.removeAllElements(); 209 for (int i = 0; i < ejbDeploymentArray.length; i++) { 210 _ejbDeploymentList.addElement(ejbDeploymentArray[i]); 211 } 212 } 214 219 public static java.lang.Object unmarshal(java.io.Reader reader) 220 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 221 { 222 return (org.openejb.alt.config.ejb11.OpenejbJar) Unmarshaller.unmarshal(org.openejb.alt.config.ejb11.OpenejbJar.class, reader); 223 } 225 228 public void validate() 229 throws org.exolab.castor.xml.ValidationException 230 { 231 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); 232 validator.validate(this); 233 } 235 } 236 | Popular Tags |