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