1 25 26 package org.objectweb.jonas.jtests.beans.local; 27 28 import javax.ejb.CreateException ; 29 import javax.ejb.SessionBean ; 30 import javax.ejb.SessionContext ; 31 import javax.naming.InitialContext ; 32 import javax.transaction.UserTransaction ; 33 34 import org.objectweb.jonas.common.Log; 35 import org.objectweb.util.monolog.api.BasicLevel; 36 import org.objectweb.util.monolog.api.Logger; 37 38 39 43 public class TargetSL implements SessionBean { 44 45 static protected Logger logger = null; 46 SessionContext ejbContext; 47 48 public String string; 49 public int number; 50 public boolean createdViaCreateXX; 51 public boolean createdViaCreateYY; 52 private int [] inttable = new int[30]; 53 54 58 69 public void setSessionContext(SessionContext ctx) { 70 if (logger == null) { 71 logger = Log.getLogger(Log.JONAS_TESTS_PREFIX); 72 } 73 logger.log(BasicLevel.DEBUG, ""); 74 ejbContext = ctx; 75 } 76 77 86 public void ejbRemove() { 87 logger.log(BasicLevel.DEBUG, ""); 88 } 89 90 94 public void ejbCreate() throws CreateException { 95 logger.log(BasicLevel.DEBUG, ""); 96 97 ejbContext.getEJBHome(); 99 ejbContext.getEJBLocalHome(); 100 ejbContext.getEJBObject(); 101 ejbContext.getEJBLocalObject(); 102 ejbContext.getTimerService(); 103 104 try { 105 InitialContext ictx = new InitialContext (); 107 ictx.lookup("java:comp/env/myname"); 108 } catch (Exception e) { 109 logger.log(BasicLevel.ERROR, "Cannot lookup java:comp/env/myname: " + e); 110 throw new CreateException ("Cannot lookup java:comp/env/myname: " + e); 111 } 112 113 try { 115 ejbContext.getCallerPrincipal(); 116 throw new CreateException ("getCallerPrincipal disallowed"); 117 } catch (IllegalStateException e) { 118 logger.log(BasicLevel.DEBUG, "getCallerPrincipal disallowed"); 119 } 120 try { 121 ejbContext.isCallerInRole(""); 122 throw new CreateException ("isCallerInRole disallowed"); 123 } catch (IllegalStateException e) { 124 logger.log(BasicLevel.DEBUG, "isCallerInRole disallowed"); 125 } 126 } 127 128 132 public void ejbPassivate() { 133 logger.log(BasicLevel.DEBUG, ""); 134 } 135 136 141 public void ejbActivate() { 142 logger.log(BasicLevel.DEBUG, ""); 143 } 144 145 149 152 public int getTwenty() { 153 logger.log(BasicLevel.DEBUG, ""); 154 return 20; 155 } 156 157 160 public void lmethod2(java.lang.String s) { 161 logger.log(BasicLevel.DEBUG, ""); 162 } 163 164 168 171 public int getTen() { 172 logger.log(BasicLevel.DEBUG, ""); 173 return 10; 174 } 175 176 179 public void method2(java.lang.String s) { 180 logger.log(BasicLevel.DEBUG, ""); 181 } 182 183 187 public int getNumber() { 188 logger.log(BasicLevel.DEBUG, ""); 189 return 0; 190 } 191 192 196 public String getString() { 197 logger.log(BasicLevel.DEBUG, ""); 198 return null; 199 } 200 201 205 public boolean isCreatedViaCreateXX() { 206 logger.log(BasicLevel.DEBUG, ""); 207 return false; 208 } 209 210 211 } 212 | Popular Tags |