1 22 package org.jboss.test.invokers.ejb; 23 24 import java.rmi.RemoteException ; 25 import javax.ejb.CreateException ; 26 import javax.ejb.SessionBean ; 27 import javax.ejb.SessionContext ; 28 import javax.naming.InitialContext ; 29 30 import org.jboss.test.invokers.interfaces.SimpleBMP; 31 import org.jboss.test.invokers.interfaces.SimpleBMPHome; 32 33 38 public class StatelessSessionBean implements SessionBean 39 { 40 static org.jboss.logging.Logger log = 41 org.jboss.logging.Logger.getLogger(StatelessSessionBean.class); 42 43 private SessionContext sessionContext; 44 45 public void ejbCreate() throws CreateException 46 { 47 log.debug("StatelessSessionBean.ejbCreate() called"); 48 } 49 50 public void ejbActivate() 51 { 52 log.debug("StatelessSessionBean.ejbActivate() called"); 53 } 54 55 public void ejbPassivate() 56 { 57 log.debug("StatelessSessionBean.ejbPassivate() called"); 58 } 59 60 public void ejbRemove() 61 { 62 log.debug("StatelessSessionBean.ejbRemove() called"); 63 } 64 65 public void setSessionContext(SessionContext context) 66 { 67 sessionContext = context; 68 } 69 70 public SimpleBMP getBMP(int id) throws RemoteException 71 { 72 try 73 { 74 InitialContext ctx = new InitialContext (); 75 SimpleBMPHome home = (SimpleBMPHome)ctx.lookup("java:comp/env/ejb/SimpleBMP"); 76 return home.findByPrimaryKey(new Integer (id)); 77 } 78 catch (Exception ex) 79 { 80 ex.printStackTrace(); 81 throw new RemoteException ("error"); 82 } 83 } 84 85 } 86 | Popular Tags |