1 22 package org.jboss.ejb3.test.dd.web.ejb; 23 24 import javax.naming.InitialContext ; 25 import javax.annotation.security.PermitAll; 26 import javax.ejb.CreateException ; 27 import javax.ejb.EJBException ; 28 import javax.ejb.SessionContext ; 29 30 import org.jboss.ejb3.test.dd.web.interfaces.ReferenceTest; 31 import org.jboss.ejb3.test.dd.web.interfaces.StatelessSession; 32 import org.jboss.ejb3.test.dd.web.interfaces.ReturnData; 33 import org.jboss.logging.Logger; 34 35 40 public class StatelessSessionBean2 41 { 42 static Logger log = Logger.getLogger(StatelessSessionBean2.class); 43 44 private SessionContext sessionContext; 45 46 public void setSessionContext(SessionContext context) 47 { 48 sessionContext = context; 49 } 50 51 public String echo(String arg) 52 { 53 return arg; 54 } 55 56 public String forward(String echoArg) 57 { 58 String echo = null; 59 try 60 { 61 InitialContext ctx = new InitialContext (); 62 StatelessSession bean = (StatelessSession) ctx.lookup("java:comp/env/ejb/Session"); 63 echo = bean.echo(echoArg); 64 } 65 catch (Exception e) 66 { 67 throw new EJBException (e); 68 } 69 return echo; 70 } 71 72 public void noop(ReferenceTest test, boolean optimized) 73 { 74 boolean wasSerialized = test.getWasSerialized(); 75 76 if (optimized && wasSerialized == true) 77 throw new EJBException ("Optimized call had non-optimized(i.e. serialized) argument"); 78 if (optimized == false && wasSerialized == false) 79 throw new EJBException ("Non-optimized call had optimized (i.e. non-serialized) argument"); 80 } 81 82 public ReturnData getData() 83 { 84 ReturnData data = new ReturnData(); 85 data.data = "TheReturnData2"; 86 return data; 87 } 88 89 90 public void unchecked() 91 { 92 log.debug("unchecked"); 93 } 94 95 98 public void checkRunAs() 99 { 100 log.debug("checkRunAs"); 101 } 102 } 103 | Popular Tags |