1 package org.jboss.test.security.ejb; 2 3 import org.jboss.logging.Logger; 4 5 import javax.ejb.SessionBean ; 6 import javax.ejb.SessionContext ; 7 import javax.ejb.CreateException ; 8 import java.security.Principal ; 9 10 15 public class MissingMethodBean implements SessionBean 16 { 17 private static Logger log = Logger.getLogger(MissingMethodBean.class); 18 private SessionContext sessionContext; 19 20 public void ejbCreate() throws CreateException 21 { 22 MissingMethodBean.log.debug("ejbCreate() called"); 23 } 24 25 public void ejbActivate() 26 { 27 MissingMethodBean.log.debug("ejbActivate() called"); 28 } 29 30 public void ejbPassivate() 31 { 32 MissingMethodBean.log.debug("ejbPassivate() called"); 33 } 34 35 public void ejbRemove() 36 { 37 MissingMethodBean.log.debug("ejbRemove() called"); 38 } 39 40 public void setSessionContext(SessionContext context) 41 { 42 sessionContext = context; 43 } 44 45 public String invokeEcho(String arg) 46 { 47 log.debug("invokeEcho, arg="+arg); 48 Principal p = sessionContext.getCallerPrincipal(); 49 log.debug("echo, callerPrincipal="+p); 50 boolean isCaller = sessionContext.isCallerInRole("EchoCaller"); 51 log.debug("echo, isCallerInRole('EchoCaller')="+isCaller); 52 isCaller = sessionContext.isCallerInRole("InternalRole"); 53 log.debug("echo, isCallerInRole('InternalRole')="+isCaller); 54 return arg; 55 } 56 57 public void callEcho() 58 { 59 log.debug("callEcho"); 60 } 61 62 public void noop() 63 { 64 log.debug("noop"); 65 } 66 } 67 | Popular Tags |