1 22 package org.jboss.ejb3.test.ejbcontext; 23 24 import javax.annotation.Resource; 25 import javax.ejb.Local ; 26 import javax.ejb.Remote ; 27 import javax.ejb.SessionContext ; 28 import javax.ejb.Stateless ; 29 30 import org.jboss.annotation.ejb.LocalBinding; 31 import org.jboss.annotation.ejb.RemoteBinding; 32 import org.jboss.logging.Logger; 33 34 40 @Stateless(name="Stateless") 41 @Local (StatelessLocal.class) 42 @Remote (org.jboss.ejb3.test.ejbcontext.Stateless.class) 43 @LocalBinding(jndiBinding = "StatelessLocal") 44 @RemoteBinding(jndiBinding = "Stateless") 45 public class StatelessBean 46 implements org.jboss.ejb3.test.ejbcontext.Stateless, StatelessLocal 47 { 48 private static final Logger log = Logger.getLogger(StatelessBean.class); 49 50 @Resource 51 SessionContext sessionContext; 52 53 public void noop() 54 { 55 56 } 57 58 public void testEjbContextLookup() throws Exception 59 { 60 Stateful stateful = (Stateful)sessionContext.lookup("Stateful"); 61 stateful.test(); 62 } 63 64 public Class testInvokedBusinessInterface() throws Exception 65 { 66 return sessionContext.getInvokedBusinessInterface(); 67 } 68 69 public Object testBusinessObject(Class businessInterface) throws Exception 70 { 71 return sessionContext.getBusinessObject(businessInterface); 72 } 73 74 public void testEjbObject() throws Exception 75 { 76 javax.ejb.EJBObject ejbObject = sessionContext.getEJBObject(); 77 ejbObject.getHandle(); 78 } 79 80 public void testEjbLocalObject() throws Exception 81 { 82 javax.ejb.EJBLocalObject ejbObject = sessionContext.getEJBLocalObject(); 83 ejbObject.getClass(); 84 } 85 } 86 | Popular Tags |