1 19 package org.netbeans.modules.j2ee.websphere6.dd.beans; 20 21 import org.w3c.dom.*; 22 import org.netbeans.modules.schema2beans.*; 23 import java.beans.*; 24 import java.util.*; 25 29 public class EjbBindingsType extends org.netbeans.modules.schema2beans.BaseBean implements DDXmiConstants { 30 31 static Vector comparators = new Vector(); 32 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 33 34 35 public EjbBindingsType() { 36 this(Common.USE_DEFAULT_VALUES); 37 } 38 public EjbBindingsType(int options) { 39 super(comparators,runtimeVersion); 40 initPropertyTables(4); 42 this.createProperty(ENTERPRISE_BEAN_ID, 43 ENTERPRISE_BEAN, 44 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 45 java.lang.String .class); 46 47 this.createAttribute(ENTERPRISE_BEAN, HREF_ID, ENTERPRISE_BEAN_HREF, 48 AttrProp.CDATA | AttrProp.IMPLIED, 49 null, null); 50 this.createAttribute(ENTERPRISE_BEAN, XMI_TYPE_ID, ENTERPRISE_BEAN_TYPE, 51 AttrProp.CDATA | AttrProp.IMPLIED, 52 null, null); 53 this.createProperty(RES_REF_BINDINGS_ID, 54 RES_REF_BINDINGS, 55 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 56 ResRefBindingsType.class); 57 this.createAttribute(RES_REF_BINDINGS,XMI_ID_ID ,RES_REF_BINDINGS_XMI_ID ,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 58 this.createAttribute(RES_REF_BINDINGS,JNDI_NAME_ID ,RES_REF_BINDINGS_JNDI_NAME ,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 59 60 this.createProperty(EJB_REF_BINDINGS_ID, 61 EJB_REF_BINDINGS, 62 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 63 EjbRefBindingsType.class); 64 this.createAttribute(EJB_REF_BINDINGS,XMI_ID_ID ,EJB_REF_BINDINGS_XMI_ID ,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 65 this.createAttribute(EJB_REF_BINDINGS,JNDI_NAME_ID ,EJB_REF_BINDINGS_JNDI_NAME ,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 66 67 this.createProperty(RES_ENV_REF_BINDINGS_ID, RES_ENV_REF_BINDINGS, 69 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 70 ResEnvRefBindingsType.class); 71 this.createAttribute(RES_ENV_REF_BINDINGS,XMI_ID_ID ,RES_ENV_REF_BINDINGS_XMI_ID ,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 72 this.createAttribute(RES_ENV_REF_BINDINGS,JNDI_NAME_ID ,RES_ENV_REF_BINDINGS_JNDI_NAME ,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 73 74 75 this.createProperty(CMP_CONNECTION_FACTORY_ID, 76 CMP_CONNECTION_FACTORY, 77 Common.TYPE_0_1 | Common.TYPE_STRING| Common.TYPE_KEY, 78 java.lang.String .class); 79 this.createAttribute(CMP_CONNECTION_FACTORY,XMI_ID_ID,CMP_CONNECTION_FACTORY_XMI_ID,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 80 this.createAttribute(CMP_CONNECTION_FACTORY,JNDI_NAME_ID,CMP_CONNECTION_FACTORY_JNDI_NAME,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 81 this.createAttribute(CMP_CONNECTION_FACTORY,RES_AUTH_ID,CMP_CONNECTION_FACTORY_RES_AUTH,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 82 83 this.initialize(options); 84 } 85 public void initialize(int options) { 86 setHref(""); 87 } 88 89 public void setEnterpriseBean(String value) { 90 this.setValue(ENTERPRISE_BEAN, value); 91 } 92 93 public String getEnterpriseBean() { 94 return ( String )this.getValue(ENTERPRISE_BEAN); 95 } 96 97 public void setXmiId(String value) { 98 this.setAttributeValue(EJB_BINDINGS_XMI_ID,value); 99 } 100 101 public String getXmiId() { 102 return this.getAttributeValue(EJB_BINDINGS_XMI_ID); 103 } 104 105 public void setJndiName(String value) { 106 this.setAttributeValue(EJB_BINDINGS_JNDI_NAME,value); 107 } 108 public String getJndiName() { 109 return this.getAttributeValue(EJB_BINDINGS_JNDI_NAME); 110 } 111 public CommonRef [] getReferences() { 112 ResRefBindingsType[] res=getResRefBindings(); 113 EjbRefBindingsType[] ejb=getEjbRefBindings(); 114 ResEnvRefBindingsType[] resenv=getResEnvRefBindings(); 115 CommonRef ref[]=new CommonRef[res.length+ejb.length+resenv.length]; 116 int index=0; 117 for (int i=0;i<res.length;i++) { 118 ref[index++]=res[i]; 119 } 120 for (int i=0;i<ejb.length;i++) { 121 ref[index++]=ejb[i]; 122 } 123 for (int i=0;i<resenv.length;i++) { 124 ref[index++]=resenv[i]; 125 } 126 return ref; 127 } 128 129 130 131 public void setResRefBindings(int index,ResRefBindingsType value) { 133 this.setValue(RES_REF_BINDINGS, index,value); 134 } 135 136 public void setResRefBindings(ResRefBindingsType[]value) { 137 this.setValue(RES_REF_BINDINGS, value); 138 } 139 140 public ResRefBindingsType[] getResRefBindings() { 141 return (ResRefBindingsType[]) this.getValues(RES_REF_BINDINGS); 142 } 143 public ResRefBindingsType getResRefBindings(int index) { 144 return (ResRefBindingsType)this.getValue(RES_REF_BINDINGS,index); 145 } 146 public int sizeResRefBindings() { 147 return this.size(RES_REF_BINDINGS); 148 } 149 public int addResRefBindings(ResRefBindingsType value) { 150 int positionOfNewItem = this.addValue(RES_REF_BINDINGS, value); 151 return positionOfNewItem; 152 } 153 154 public int removeResRefBindings(ResRefBindingsType value) { 155 return this.removeValue(RES_REF_BINDINGS, value); 156 } 157 158 public void setResEnvRefBindings(int index,ResEnvRefBindingsType value) { 160 this.setValue(RES_ENV_REF_BINDINGS, index,value); 161 } 162 163 public void setResEnvRefBindings(ResEnvRefBindingsType[]value) { 164 this.setValue(RES_ENV_REF_BINDINGS, value); 165 } 166 167 public ResEnvRefBindingsType[] getResEnvRefBindings() { 168 return (ResEnvRefBindingsType[]) this.getValues(RES_ENV_REF_BINDINGS); 169 } 170 public ResEnvRefBindingsType getResEnvRefBindings(int index) { 171 return (ResEnvRefBindingsType)this.getValue(RES_ENV_REF_BINDINGS,index); 172 } 173 public int sizeResEnvRefBindings() { 174 return this.size(RES_ENV_REF_BINDINGS); 175 } 176 public int addResEnvRefBindings(ResEnvRefBindingsType value) { 177 int positionOfNewItem = this.addValue(RES_ENV_REF_BINDINGS, value); 178 return positionOfNewItem; 179 } 180 181 public int removeResEnvRefBindings(ResEnvRefBindingsType value) { 182 return this.removeValue(RES_ENV_REF_BINDINGS, value); 183 } 184 185 public void setEjbRefBindings(int index,EjbRefBindingsType value) { 187 this.setValue(EJB_REF_BINDINGS, index,value); 188 } 189 190 public void setEjbRefBindings(EjbRefBindingsType[]value) { 191 this.setValue(EJB_REF_BINDINGS, value); 192 } 193 194 public EjbRefBindingsType[] getEjbRefBindings() { 195 return (EjbRefBindingsType[]) this.getValues(EJB_REF_BINDINGS); 196 } 197 public EjbRefBindingsType getEjbRefBindings(int index) { 198 return (EjbRefBindingsType)this.getValue(EJB_REF_BINDINGS,index); 199 } 200 public int sizeEjbRefBindings() { 201 return this.size(EJB_REF_BINDINGS); 202 } 203 public int addEjbRefBindings(EjbRefBindingsType value) { 204 int positionOfNewItem = this.addValue(EJB_REF_BINDINGS, value); 205 return positionOfNewItem; 206 } 207 208 public int removeEjbRefBindings(EjbRefBindingsType value) { 209 return this.removeValue(EJB_REF_BINDINGS, value); 210 } 211 212 public int addReferenceBinding(CommonRef reference){ 213 if(reference instanceof ResRefBindingsType) { 214 return addResRefBindings((ResRefBindingsType)reference); 215 } else if(reference instanceof ResEnvRefBindingsType) { 216 return addResEnvRefBindings((ResEnvRefBindingsType)reference); 217 } else if(reference instanceof EjbRefBindingsType) { 218 return addEjbRefBindings((EjbRefBindingsType)reference); 219 } 220 else return 0; 221 } 222 public int removeReferenceBinding(CommonRef reference){ 223 if(reference instanceof ResRefBindingsType) { 224 return removeResRefBindings((ResRefBindingsType)reference); 225 } else if(reference instanceof ResEnvRefBindingsType) { 226 return removeResEnvRefBindings((ResEnvRefBindingsType)reference); 227 } else if(reference instanceof EjbRefBindingsType) { 228 return removeEjbRefBindings((EjbRefBindingsType)reference); 229 } 230 else return 0; 231 } 232 233 public void setCmpConnectionFactory(String value) { 234 this.setValue(CMP_CONNECTION_FACTORY,value); 235 } 236 public String getCmpConnectionFactory() { 237 return (String )this.getValue(CMP_CONNECTION_FACTORY); 238 } 239 public void setCmpConnectionFactoryXmiId(String value) { 240 if(size(CMP_CONNECTION_FACTORY)==0) { 241 setCmpConnectionFactory(""); 242 } 243 this.setAttributeValue(CMP_CONNECTION_FACTORY,CMP_CONNECTION_FACTORY_XMI_ID,value); 244 } 245 public String getCmpConnectionFactoryXmiId() { 246 if(size(CMP_CONNECTION_FACTORY)==0) { 247 return null; 248 } 249 return (String ) this.getAttributeValue(CMP_CONNECTION_FACTORY,CMP_CONNECTION_FACTORY_XMI_ID); 250 } 251 public void setCmpConnectionFactoryJndiName(String value) { 252 if(size(CMP_CONNECTION_FACTORY)==0) { 253 setCmpConnectionFactory(""); 254 } 255 this.setAttributeValue(CMP_CONNECTION_FACTORY,CMP_CONNECTION_FACTORY_JNDI_NAME,value); 256 } 257 public String getCmpConnectionFactoryJndiName() { 258 if(size(CMP_CONNECTION_FACTORY)==0) { 259 return null; 260 } 261 return (String ) this.getAttributeValue(CMP_CONNECTION_FACTORY,CMP_CONNECTION_FACTORY_JNDI_NAME); 262 } 263 public void setCmpConnectionFactoryResAuth(String value) { 264 if(size(CMP_CONNECTION_FACTORY)==0) { 265 setCmpConnectionFactory(""); 266 } 267 this.setAttributeValue(CMP_CONNECTION_FACTORY,CMP_CONNECTION_FACTORY_RES_AUTH,value); 268 } 269 public String getCmpConnectionFactoryResAuth() { 270 if(size(CMP_CONNECTION_FACTORY)==0) { 271 return null; 272 } 273 return (String ) this.getAttributeValue(CMP_CONNECTION_FACTORY,CMP_CONNECTION_FACTORY_RES_AUTH); 274 } 275 276 277 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 279 comparators.add(c); 280 } 281 282 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 284 comparators.remove(c); 285 } 286 287 public void setHref(java.lang.String value) { 288 setAttributeValue(ENTERPRISE_BEAN, ENTERPRISE_BEAN_HREF,DDXmi.addEjbJarHrefToId(value)); 289 } 290 291 public String getHref() { 292 return DDXmi.getIdFromHref((String )getAttributeValue(ENTERPRISE_BEAN, ENTERPRISE_BEAN_HREF)); 293 } 294 295 public void setXmiType(java.lang.String value) { 296 setAttributeValue(ENTERPRISE_BEAN, ENTERPRISE_BEAN_TYPE,value); 297 } 298 299 public String getXmiType() { 300 return (String )getAttributeValue(ENTERPRISE_BEAN, ENTERPRISE_BEAN_TYPE); 301 } 302 303 304 305 306 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 307 308 if(getEnterpriseBean()==null) { 309 throw new org.netbeans.modules.schema2beans.ValidateException("getEnterpriseBean() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "EnterpriseBean", this); } 311 if(getHref()==null) { 312 throw new org.netbeans.modules.schema2beans.ValidateException("getHref() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "EnterpriseBean", this); } 314 if(getXmiType()==null) { 315 throw new org.netbeans.modules.schema2beans.ValidateException("getXmiType() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "EnterpriseBean", this); } 317 if(getXmiType()!=EJB_ENTERPRISE_BEAN_TYPE_SESSION) { 318 throw new org.netbeans.modules.schema2beans.ValidateException("getXmiType()!= ejb:Session", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "EnterpriseBean", this); } 320 } 321 public void dump(StringBuffer str, String indent){ 323 String s; 324 Object o; 325 org.netbeans.modules.schema2beans.BaseBean n; 326 str.append(indent); 327 str.append("EnterpriseBean"); str.append(indent+"\t"); str.append("<"); o = this.getEnterpriseBean(); 331 str.append((o==null?"null":o.toString().trim())); str.append(">\n"); this.dumpAttributes(ENTERPRISE_BEAN, 0, str, indent); 334 335 336 } 337 public String dumpBeanNode(){ 338 StringBuffer str = new StringBuffer (); 339 str.append(getClass().getName()); this.dump(str, "\n "); return str.toString(); 342 } 343 } 344 | Popular Tags |