1 22 package org.jboss.test.bankiiop.ejb; 23 24 import java.rmi.*; 25 import javax.naming.*; 26 import javax.ejb.*; 27 28 import org.jboss.test.util.ejb.SessionSupport; 29 import org.jboss.test.bankiiop.interfaces.*; 30 31 37 public class BankBean 38 extends SessionSupport 39 { 40 42 static final String ID = "java:comp/env/id"; 44 String id; 45 46 static long nextAccountId = System.currentTimeMillis(); 48 static long nextCustomerId = System.currentTimeMillis(); 49 50 52 public String getId() 54 { 55 return id; 56 } 57 58 public String createAccountId(Customer customer) 59 throws RemoteException 60 { 61 return getId()+"."+customer.getName()+"."+(nextAccountId++); 62 } 63 64 public String createCustomerId() 65 { 66 return getId()+"."+(nextCustomerId++); 67 } 68 69 public void setSessionContext(SessionContext context) 71 { 72 super.setSessionContext(context); 73 74 try 75 { 76 id = (String )new InitialContext().lookup(ID); 77 } catch (Exception e) 78 { 79 log.debug(e); 80 throw new EJBException(e); 81 } 82 } 83 } 84 85 109 | Popular Tags |