1 26 27 package jaasclient.beans.secusb; 28 29 import javax.ejb.EJBException; 30 import javax.ejb.SessionBean; 31 import javax.ejb.SessionContext; 32 import javax.ejb.SessionSynchronization; 33 34 38 public class JAASOpBean implements SessionBean, SessionSynchronization { 39 40 43 private int total = 0; 44 45 48 private int newtotal = 0; 49 50 53 private String clientUser = null; 54 55 56 57 62 public void ejbCreate(String user) { 63 total = 0; 64 newtotal = total; 66 clientUser = user; 67 } 68 69 70 71 86 public void ejbActivate() throws EJBException, java.rmi.RemoteException { 87 } 89 90 107 public void ejbPassivate() throws EJBException, java.rmi.RemoteException { 108 } 110 111 126 public void ejbRemove() throws EJBException, java.rmi.RemoteException { 127 } 129 130 146 public void setSessionContext(SessionContext sessionContext) throws EJBException, java.rmi.RemoteException { 147 } 148 149 153 154 171 public void afterBegin() throws EJBException, java.rmi.RemoteException { 172 newtotal = total; 173 } 174 175 193 public void beforeCompletion() throws EJBException, java.rmi.RemoteException { 194 } 195 196 213 public void afterCompletion(boolean committed) throws EJBException, java.rmi.RemoteException { 214 215 if (committed) { 216 total = newtotal; 217 } else { 218 newtotal = total; 219 } 220 } 221 222 223 224 228 public void buy(int s) { 229 newtotal = newtotal + s; 230 return; 231 } 232 233 237 public int read() { 238 return newtotal; 239 } 240 } | Popular Tags |