1 25 26 package org.objectweb.jonas.jtests.beans.sequence; 27 28 import java.rmi.RemoteException ; 29 30 import javax.ejb.CreateException ; 31 import javax.ejb.EJBException ; 32 import javax.ejb.SessionBean ; 33 import javax.ejb.SessionContext ; 34 import javax.naming.InitialContext ; 35 import javax.naming.NamingException ; 36 37 38 44 public class WoSesSL implements SessionBean { 45 46 private String className = "WoSesSL"; 47 private WoHomeLocal woHome; 48 private SequenceSesHome sequenceSesHome; 49 56 public void ejbCreate() throws CreateException { 57 } 58 65 public Integer schedule(String assId, int qty) { 66 67 68 WoLocal wo; 69 Integer woId = null; 70 71 try { 72 wo = woHome.create(assId, qty); 73 woId = wo.getId(); 74 75 } catch( CreateException e ) { 76 throw new EJBException ("Unable to create " + e); 77 } catch( EJBException e ) { 78 e.printStackTrace(); 79 throw new EJBException (e); 80 } 81 return woId; 82 } 83 84 85 90 public WoSesSL() { 91 } 92 93 98 public void ejbRemove() { 99 } 100 101 106 public void ejbActivate() { 107 } 108 109 114 public void ejbPassivate() { 115 } 116 117 124 public void setSessionContext(SessionContext sc) { 125 126 InitialContext initCtx; 127 128 try { 129 initCtx = new InitialContext (); 130 woHome = (WoHomeLocal) initCtx.lookup("java:comp/env/ejb/WoLocalHome"); 131 sequenceSesHome = 132 (SequenceSesHome) javax.rmi.PortableRemoteObject.narrow( 133 initCtx.lookup("SequencesHome"), 134 SequenceSesHome.class); 135 } catch( NamingException e ) { 136 e.printStackTrace(); 137 138 throw new EJBException (e); 139 } 140 141 } 142 } 143 144 | Popular Tags |