1 45 package org.openejb.test.stateful; 46 47 import java.rmi.RemoteException ; 48 49 import javax.ejb.EJBException ; 50 import javax.ejb.EJBHome ; 51 import javax.ejb.EJBMetaData ; 52 import javax.ejb.EJBObject ; 53 import javax.ejb.Handle ; 54 import javax.ejb.SessionContext ; 55 import javax.naming.InitialContext ; 56 57 import org.openejb.test.object.ObjectGraph; 58 59 64 public class RmiIiopStatefulBean implements javax.ejb.SessionBean { 65 66 private String name; 67 private SessionContext ejbContext; 68 69 70 77 78 82 83 84 85 public String returnStringObject(String data) { 86 return data; 87 } 88 89 public String [] returnStringObjectArray(String [] data) { 90 return data; 91 } 92 93 94 95 96 97 public Character returnCharacterObject(Character data) { 98 return data; 99 } 100 101 public char returnCharacterPrimitive(char data) { 102 return data; 103 } 104 105 public Character [] returnCharacterObjectArray(Character [] data) { 106 return data; 107 } 108 109 public char[] returnCharacterPrimitiveArray(char[] data) { 110 return data; 111 } 112 113 114 115 116 public Boolean returnBooleanObject(Boolean data) { 117 return data; 118 } 119 120 public boolean returnBooleanPrimitive(boolean data) { 121 return data; 122 } 123 124 public Boolean [] returnBooleanObjectArray(Boolean [] data) { 125 return data; 126 } 127 128 public boolean[] returnBooleanPrimitiveArray(boolean[] data) { 129 return data; 130 } 131 132 133 134 135 136 public Byte returnByteObject(Byte data) { 137 return data; 138 } 139 140 public byte returnBytePrimitive(byte data) { 141 return data; 142 } 143 144 public Byte [] returnByteObjectArray(Byte [] data) { 145 return data; 146 } 147 148 public byte[] returnBytePrimitiveArray(byte[] data) { 149 return data; 150 } 151 152 153 154 155 156 public Short returnShortObject(Short data) { 157 return data; 158 } 159 160 public short returnShortPrimitive(short data) { 161 return data; 162 } 163 164 public Short [] returnShortObjectArray(Short [] data) { 165 return data; 166 } 167 168 public short[] returnShortPrimitiveArray(short[] data) { 169 return data; 170 } 171 172 173 174 175 176 public Integer returnIntegerObject(Integer data) { 177 return data; 178 } 179 180 public int returnIntegerPrimitive(int data) { 181 return data; 182 } 183 184 public Integer [] returnIntegerObjectArray(Integer [] data) { 185 return data; 186 } 187 188 public int[] returnIntegerPrimitiveArray(int[] data) { 189 return data; 190 } 191 192 193 194 195 196 public Long returnLongObject(Long data) { 197 return data; 198 } 199 200 public long returnLongPrimitive(long data) { 201 return data; 202 } 203 204 public Long [] returnLongObjectArray(Long [] data) { 205 return data; 206 } 207 208 public long[] returnLongPrimitiveArray(long[] data) { 209 return data; 210 } 211 212 213 214 215 216 public Float returnFloatObject(Float data) { 217 return data; 218 } 219 220 public float returnFloatPrimitive(float data) { 221 return data; 222 } 223 224 public Float [] returnFloatObjectArray(Float [] data) { 225 return data; 226 } 227 228 public float[] returnFloatPrimitiveArray(float[] data) { 229 return data; 230 } 231 232 233 234 235 236 public Double returnDoubleObject(Double data) { 237 return data; 238 } 239 240 public double returnDoublePrimitive(double data) { 241 return data; 242 } 243 244 public Double [] returnDoubleObjectArray(Double [] data) { 245 return data; 246 } 247 248 public double[] returnDoublePrimitiveArray(double[] data) { 249 return data; 250 } 251 252 253 254 255 256 257 public EJBHome returnEJBHome(EJBHome data) { 258 return data; 259 } 260 261 public EJBHome returnEJBHome() throws javax.ejb.EJBException { 262 EJBHome data = null; 263 264 try{ 265 InitialContext ctx = new InitialContext (); 266 267 data = (EJBHome )ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 268 269 } catch (Exception e){ 270 e.printStackTrace(); 271 throw new javax.ejb.EJBException (e); 272 } 273 return data; 274 } 275 276 public ObjectGraph returnNestedEJBHome() throws javax.ejb.EJBException { 277 ObjectGraph data = null; 278 279 try{ 280 InitialContext ctx = new InitialContext (); 281 282 Object object = ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 283 data = new ObjectGraph(object); 284 285 } catch (Exception e){ 286 throw new javax.ejb.EJBException (e); 287 } 288 return data; 289 } 290 291 public EJBHome [] returnEJBHomeArray(EJBHome [] data) { 292 return data; 293 } 294 295 296 297 298 299 public EJBObject returnEJBObject(EJBObject data) { 300 return data; 301 } 302 303 public EJBObject returnEJBObject() throws javax.ejb.EJBException { 304 EncStatefulObject data = null; 305 306 try{ 307 InitialContext ctx = new InitialContext (); 308 309 EncStatefulHome home = (EncStatefulHome)ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 310 data = home.create("Test01 StatefulBean"); 311 312 } catch (Exception e){ 313 throw new javax.ejb.EJBException (e); 314 } 315 return data; 316 } 317 318 public ObjectGraph returnNestedEJBObject() throws javax.ejb.EJBException { 319 ObjectGraph data = null; 320 321 try{ 322 InitialContext ctx = new InitialContext (); 323 324 EncStatefulHome home = (EncStatefulHome)ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 325 EncStatefulObject object = home.create("Test02 StatefulBean"); 326 data = new ObjectGraph(object); 327 328 } catch (Exception e){ 329 throw new javax.ejb.EJBException (e); 330 } 331 return data; 332 } 333 334 public EJBObject [] returnEJBObjectArray(EJBObject [] data) { 335 return data; 336 } 337 338 339 340 341 342 public EJBMetaData returnEJBMetaData(EJBMetaData data) { 343 return data; 344 } 345 346 public EJBMetaData returnEJBMetaData() throws javax.ejb.EJBException { 347 EJBMetaData data = null; 348 349 try{ 350 InitialContext ctx = new InitialContext (); 351 352 EncStatefulHome home = (EncStatefulHome)ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 353 data = home.getEJBMetaData(); 354 355 } catch (Exception e){ 356 throw new javax.ejb.EJBException (e); 357 } 358 return data; 359 } 360 361 public ObjectGraph returnNestedEJBMetaData() throws javax.ejb.EJBException { 362 ObjectGraph data = null; 363 364 try{ 365 InitialContext ctx = new InitialContext (); 366 367 EncStatefulHome home = (EncStatefulHome)ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 368 EJBMetaData object = home.getEJBMetaData(); 369 data = new ObjectGraph(object); 370 371 } catch (Exception e){ 372 throw new javax.ejb.EJBException (e); 373 } 374 return data; 375 } 376 377 public EJBMetaData [] returnEJBMetaDataArray(EJBMetaData [] data) { 378 return data; 379 } 380 381 382 383 384 385 public Handle returnHandle(Handle data) { 386 return data; 387 } 388 389 public Handle returnHandle() throws javax.ejb.EJBException { 390 Handle data = null; 391 392 try{ 393 InitialContext ctx = new InitialContext (); 394 395 EncStatefulHome home = (EncStatefulHome)ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 396 EncStatefulObject object = home.create("Test03 StatefulBean"); 397 data = object.getHandle(); 398 399 } catch (Exception e){ 400 throw new javax.ejb.EJBException (e); 401 } 402 return data; 403 } 404 405 public ObjectGraph returnNestedHandle() throws javax.ejb.EJBException { 406 ObjectGraph data = null; 407 408 try{ 409 InitialContext ctx = new InitialContext (); 410 411 EncStatefulHome home = (EncStatefulHome)ctx.lookup("java:comp/env/stateful/rmi-iiop/home"); 412 EncStatefulObject object = home.create("Test04 StatefulBean"); 413 data = new ObjectGraph(object.getHandle()); 414 415 } catch (Exception e){ 416 throw new javax.ejb.EJBException (e); 417 } 418 return data; 419 } 420 421 public Handle [] returnHandleArray(Handle [] data) { 422 return data; 423 } 424 425 426 427 428 429 public ObjectGraph returnObjectGraph(ObjectGraph data) { 430 return data; 431 } 432 433 public ObjectGraph[] returnObjectGraphArray(ObjectGraph[] data) { 434 return data; 435 } 436 440 441 448 public void setSessionContext(SessionContext ctx) throws EJBException ,RemoteException { 449 ejbContext = ctx; 450 } 451 456 public void ejbCreate(String name) throws javax.ejb.CreateException { 457 this.name = name; 458 } 459 465 public void ejbRemove() throws EJBException ,RemoteException { 466 } 467 468 473 public void ejbActivate() throws EJBException ,RemoteException { 474 } 476 481 public void ejbPassivate() throws EJBException ,RemoteException { 482 } 484 485 } 489 | Popular Tags |