1 2 8 29 package org.jboss.test.testbean.bean; 30 31 import java.rmi.*; 32 import javax.ejb.*; 33 34 public class StatefulSessionBean implements SessionBean { 35 public static org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(StatefulSessionBean.class); 36 private SessionContext sessionContext; 37 public String name; 38 39 public void ejbCreate() throws RemoteException, CreateException { 40 41 log.debug("StatefulSessionBean.ejbCreate() called"); 42 this.name= "noname"; 43 } 44 45 public void ejbCreate(String name) throws RemoteException, CreateException { 46 log.debug("StatefulSessionBean.ejbCreate("+name+") called"); 47 this.name = name; 48 } 49 50 public void ejbCreate(String name, String address) throws RemoteException, CreateException { 51 log.debug("StatefulSessionBean.ejbCreate("+name+"@"+address+") called"); 52 this.name = name; 53 } 54 55 public void ejbCreateMETHOD(String name, String address) throws RemoteException, CreateException { 56 log.debug("StatefulSessionBean.ejbCreateMETHOD("+name+"@"+address+") called"); 57 this.name = name; 58 } 59 60 public void ejbActivate() throws RemoteException { 61 log.debug("StatefulSessionBean.ejbActivate() called"); 62 } 63 64 public void ejbPassivate() throws RemoteException { 65 log.debug("StatefulSessionBean.ejbPassivate() called"); 66 } 67 68 public void ejbRemove() throws RemoteException { 69 log.debug("StatefulSessionBean.ejbRemove() called"); 70 } 71 72 public String callBusinessMethodA() { 73 log.debug("StatefulSessionBean.callBusinessMethodA() called"); 74 return "I was created with Stateful String "+name; 75 } 76 77 public String callBusinessMethodB() { 78 log.debug("StatefulSessionBean.callBusinessMethodB() called"); 79 EJBObject ejbObject = sessionContext.getEJBObject(); 81 if (ejbObject == null) { 82 return "ISNULL:NOT FOUND!!!!!"; 83 84 } 85 else { 86 return "OK ejbObject is "+ejbObject.toString(); 87 88 } 89 } 90 91 92 public String callBusinessMethodB(String words) { 93 log.debug("StatefulSessionBean.callBusinessMethodB(String) called"); 94 EJBObject ejbObject = sessionContext.getEJBObject(); 96 if (ejbObject == null) { 97 return "ISNULL:NOT FOUND!!!!!"; 98 99 } 100 else { 101 return "OK ejbObject is "+ejbObject.toString()+" words "+words; 102 103 } 104 105 } 106 107 108 public void setSessionContext(SessionContext context) throws RemoteException { 109 log.debug("StatefulSessionBean.setSessionContext("+context+") called"); 110 sessionContext = context; 111 } 112 } 113 | Popular Tags |