1 4 package org.objectweb.jonas.jtests.beans.mcontext; 5 6 import javax.ejb.CreateException ; 7 import javax.ejb.SessionBean ; 8 import javax.ejb.SessionContext ; 9 import javax.naming.Context ; 10 import javax.naming.InitialContext ; 11 12 import org.objectweb.jonas.common.Log; 13 import org.objectweb.util.monolog.api.BasicLevel; 14 import org.objectweb.util.monolog.api.Logger; 15 16 17 20 public class BeanAccessorSLR implements SessionBean { 21 22 static private Logger logger = null; 23 SessionContext ejbContext; 24 25 29 30 public void setSessionContext(SessionContext ctx) { 31 if (logger == null) { 32 logger = Log.getLogger("org.objectweb.jonas_tests"); 33 } 34 logger.log(BasicLevel.DEBUG, ""); 35 ejbContext = ctx; 36 } 37 38 39 public void ejbRemove() { 40 logger.log(BasicLevel.DEBUG, ""); 41 } 42 43 44 public void ejbCreate() throws CreateException { 45 logger.log(BasicLevel.DEBUG, ""); 46 } 47 48 public void ejbPassivate() { 49 logger.log(BasicLevel.DEBUG, ""); 50 } 51 52 public void ejbActivate() { 53 logger.log(BasicLevel.DEBUG, ""); 54 } 55 56 60 63 public boolean localBeanHasMessageContext() { 64 logger.log(BasicLevel.DEBUG, ""); 65 try { 66 Context ctx = new InitialContext (); 67 TestMC1LocalHome home = (TestMC1LocalHome) ctx.lookup("TestMC1Home_L"); 68 TestMC1Local mc1 = home.create(); 69 return mc1.localMethodHasMessageContext(); 70 } catch (Exception e) { 71 logger.log(BasicLevel.WARN, "Something goes wrong"); 72 } 73 return true; 74 } 75 76 } 77 78 | Popular Tags |