1 25 26 package org.objectweb.jonas.jtests.beans.local; 27 28 import javax.ejb.CreateException ; 29 import javax.transaction.UserTransaction ; 30 31 import org.objectweb.util.monolog.api.BasicLevel; 32 33 37 public class TargetSF extends TargetSL { 38 39 public long mylong = 1953L; 40 public double pi = 3.14159; 41 public String mystring = "leChatQuiDort"; 42 public UserTransaction ut; 43 44 private void checkAllowedMethods() throws CreateException { 45 46 ejbContext.getEJBHome(); 48 ejbContext.getEJBLocalHome(); 49 ejbContext.getEJBObject(); 50 ejbContext.getEJBLocalObject(); 51 ejbContext.getCallerPrincipal(); 52 ejbContext.isCallerInRole(""); 53 54 try { 56 ejbContext.getTimerService(); 57 throw new CreateException ("getTimerService disallowed"); 58 } catch (IllegalStateException e) { 59 logger.log(BasicLevel.DEBUG, "getTimerService disallowed"); 60 } 61 } 62 63 68 public void ejbCreate() throws CreateException { 69 logger.log(BasicLevel.DEBUG, ""); 70 string = ""; 71 number = 0; 72 createdViaCreateXX = false; 73 createdViaCreateYY = false; 74 checkAllowedMethods(); 75 } 76 77 78 83 public void ejbCreate(String s, int n) throws CreateException { 84 logger.log(BasicLevel.DEBUG, ""); 85 string = s; 86 number = n; 87 createdViaCreateXX = false; 88 createdViaCreateYY = false; 89 checkAllowedMethods(); 90 ut = ejbContext.getUserTransaction(); 91 } 92 93 94 99 public void ejbCreateXX(String s, int n) throws CreateException { 100 logger.log(BasicLevel.DEBUG, ""); 101 string = s; 102 number = n; 103 createdViaCreateXX = true; 104 createdViaCreateYY = false; 105 checkAllowedMethods(); 106 } 107 108 113 public void ejbCreateYY(String s, int n) throws CreateException { 114 logger.log(BasicLevel.DEBUG, ""); 115 string = s; 116 number = n; 117 createdViaCreateXX = false; 118 createdViaCreateYY = true; 119 checkAllowedMethods(); 120 } 121 122 123 127 130 public int getNumber() { 131 logger.log(BasicLevel.DEBUG, ""); 132 return number; 133 } 134 135 138 public String getString() { 139 logger.log(BasicLevel.DEBUG, ""); 140 return string; 141 } 142 143 146 public boolean isCreatedViaCreateXX() { 147 logger.log(BasicLevel.DEBUG, ""); 148 return createdViaCreateXX; 149 } 150 151 155 158 public boolean isCreatedViaCreateYY() { 159 logger.log(BasicLevel.DEBUG, ""); 160 return createdViaCreateYY; 161 } 162 } 163 | Popular Tags |