1 25 26 package org.objectweb.jonas.jtests.beans.relation.oou; 27 28 import javax.ejb.CreateException ; 29 import javax.ejb.DuplicateKeyException ; 30 import javax.ejb.EJBException ; 31 import javax.ejb.EntityContext ; 32 import javax.ejb.FinderException ; 33 import javax.ejb.RemoveException ; 34 import javax.naming.Context ; 35 import javax.naming.InitialContext ; 36 import javax.naming.NamingException ; 37 import javax.rmi.PortableRemoteObject ; 38 39 import org.objectweb.jonas.common.Log; 40 import org.objectweb.util.monolog.api.BasicLevel; 41 import org.objectweb.util.monolog.api.Logger; 42 43 46 public abstract class AEC2 implements javax.ejb.EntityBean { 47 48 private BHomeLocal bhl = null; 49 50 public void m1(){ 51 } 52 53 public void assignB(String c) throws FinderException { 54 if (c != null) { 55 BLocal bl = null; 56 bl = bhl.findByPrimaryKey(c); 57 setB(bl); 58 } else 59 setB(null); 60 } 61 public void assignBInNewTx(String c) throws FinderException { 62 assignB(c); 63 } 64 65 public String retrieveB() { 66 BLocal lejbB = getB(); 67 if (lejbB==null) 68 return null; 69 else 70 return lejbB.getId(); 71 } 72 73 public String retrieveBInNewTx() { 74 return retrieveB(); 75 } 76 77 public abstract String getId(); 81 82 public abstract void setId(String id); 83 84 public abstract BLocal getB(); 85 86 public abstract void setB(BLocal bl); 87 88 89 93 static protected Logger logger = null; 94 EntityContext ejbContext; 95 96 102 public String ejbCreate(String id) throws CreateException , DuplicateKeyException { 103 logger.log(BasicLevel.DEBUG, ""); 104 105 setId(id); 107 108 return null; 110 } 111 112 122 public void setEntityContext(EntityContext ctx) { 123 if (logger == null) 124 logger = Log.getLogger(Log.JONAS_TESTS_PREFIX); 125 logger.log(BasicLevel.DEBUG, ""); 126 ejbContext = ctx; 127 try { 128 Context ictx = new InitialContext (); 129 bhl = (BHomeLocal) ictx.lookup("java:comp/env/ejb/b"); 130 } catch (NamingException e) { 131 throw new EJBException ("Impossible to fetch the ", e); 132 } 133 } 134 135 146 public void unsetEntityContext() { 147 logger.log(BasicLevel.DEBUG, ""); 148 ejbContext = null; 149 } 150 151 164 public void ejbRemove() throws RemoveException { 165 logger.log(BasicLevel.DEBUG, ""); 166 } 167 168 176 public void ejbLoad() { 177 logger.log(BasicLevel.DEBUG, ""); 178 } 179 180 188 public void ejbStore() { 189 logger.log(BasicLevel.DEBUG, ""); 190 } 191 192 197 public void ejbPostCreate(String id) throws CreateException { 198 logger.log(BasicLevel.DEBUG, "id=" + id); 199 } 200 201 205 public void ejbPassivate() { 206 logger.log(BasicLevel.DEBUG, ""); 207 } 208 209 214 public void ejbActivate() { 215 logger.log(BasicLevel.DEBUG, ""); 216 } 217 218 } 219 | Popular Tags |