1 22 package org.jboss.test.security.ejb; 23 24 import java.security.Principal ; 25 import javax.ejb.CreateException ; 26 import javax.ejb.EJBException ; 27 import javax.ejb.SessionBean ; 28 import javax.ejb.SessionContext ; 29 30 import org.jboss.logging.Logger; 31 32 37 public class StatefulSessionBean implements SessionBean 38 { 39 private static Logger log = Logger.getLogger(StatefulSessionBean.class); 40 private SessionContext sessionContext; 41 private String state; 42 43 public void ejbCreate(String state) throws CreateException 44 { 45 this.state = state; 46 log.debug("ejbCreate("+state+") called"); 47 Principal p = sessionContext.getCallerPrincipal(); 48 log.debug("ejbCreate, callerPrincipal="+p); 49 } 50 51 public void ejbActivate() 52 { 53 log.debug("ejbActivate() called"); 54 } 55 56 public void ejbPassivate() 57 { 58 log.debug("ejbPassivate() called"); 59 } 60 61 public void ejbRemove() 62 { 63 log.debug("ejbRemove() called"); 64 } 65 66 public void setSessionContext(SessionContext context) 67 { 68 sessionContext = context; 69 } 70 71 public String echo(String arg) 72 { 73 log.debug("echo, arg="+arg); 74 Principal p = sessionContext.getCallerPrincipal(); 75 log.debug("echo, callerPrincipal="+p); 76 return arg; 77 } 78 } 79 | Popular Tags |