1 22 package org.jboss.test.security.ejb; 23 24 import java.io.IOException ; 25 import java.security.Principal ; 26 import javax.ejb.CreateException ; 27 import javax.ejb.SessionBean ; 28 import javax.ejb.SessionContext ; 29 30 import org.jboss.logging.Logger; 31 32 37 public class IOStatefulSessionBean implements SessionBean 38 { 39 static Logger log = Logger.getLogger(IOStatefulSessionBean.class); 40 41 private SessionContext sessionContext; 42 private String sessionPath; 43 44 public void ejbCreate() throws CreateException 45 { 46 log.debug("ejbCreate() called"); 47 } 48 49 public void ejbActivate() 50 { 51 log.debug("ejbActivate() called"); 52 } 53 54 public void ejbPassivate() 55 { 56 log.debug("ejbPassivate() called"); 57 } 58 59 public void ejbRemove() 60 { 61 log.debug("ejbRemove() called"); 62 } 63 64 public void setSessionContext(SessionContext context) 65 { 66 sessionContext = context; 67 } 68 69 public void setPath(String path) 70 { 71 this.sessionPath = path; 72 } 73 74 public String retryableRead(String path) throws IOException 75 { 76 return read(path); 77 } 78 79 public String read(String path) throws IOException 80 { 81 log.debug("read, path=" + path); 82 Principal p = sessionContext.getCallerPrincipal(); 83 log.debug("read, callerPrincipal=" + p); 84 return path; 85 } 86 87 public void write(String path) throws IOException 88 { 89 log.debug("write, path=" + path); 90 Principal p = sessionContext.getCallerPrincipal(); 91 log.debug("write, callerPrincipal=" + p); 92 } 93 } 94 | Popular Tags |