1 22 package org.jboss.test.security.ejb; 23 24 import java.rmi.RemoteException ; 25 import java.security.Principal ; 26 import javax.ejb.CreateException ; 27 import javax.ejb.EJBException ; 28 import javax.ejb.SessionBean ; 29 import javax.ejb.SessionContext ; 30 31 import org.jboss.logging.Logger; 32 33 39 public class StatelessSessionBean4 implements SessionBean 40 { 41 private static Logger log = Logger.getLogger(StatelessSessionBean4.class); 42 43 private SessionContext sessionContext; 44 45 public void ejbCreate() throws CreateException 46 { 47 log.debug("ejbCreate() called"); 48 } 49 50 public void ejbActivate() 51 { 52 log.debug("ejbActivate() called"); 53 } 54 55 public void ejbPassivate() 56 { 57 log.debug("ejbPassivate() called"); 58 } 59 60 public void ejbRemove() 61 { 62 log.debug("ejbRemove() called"); 63 } 64 65 public void setSessionContext(SessionContext context) 66 { 67 sessionContext = context; 68 } 69 70 public String echo(String arg) 71 { 72 log.debug("echo, arg="+arg); 73 Principal p = sessionContext.getCallerPrincipal(); 74 log.debug("echo, callerPrincipal="+p); 75 return arg; 76 } 77 public String forward(String echoArg) 78 { 79 log.debug("forward, echoArg="+echoArg); 80 return echo(echoArg); 81 } 82 83 public void noop() 84 { 85 log.debug("noop"); 86 } 87 public void npeError() 88 { 89 log.debug("npeError"); 90 Object obj = null; 91 obj.toString(); 92 } 93 94 public void unchecked() 95 { 96 Principal p = sessionContext.getCallerPrincipal(); 97 log.debug("unchecked, callerPrincipal="+p); 98 } 99 100 public void excluded() 101 { 102 Principal p = sessionContext.getCallerPrincipal(); 103 log.debug("excluded, callerPrincipal="+p); 104 } 105 106 } 107 108 | Popular Tags |