1 25 26 package org.objectweb.jonas.jtests.beans.relation.oob; 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 logger.log(BasicLevel.DEBUG, "param=" + c); 55 if (c != null) { 56 BLocal bl = null; 57 bl = bhl.findByPrimaryKey(c); 58 setB(bl); 59 } else 60 setB(null); 61 } 62 public void assignBInNewTx(String c) throws FinderException { 63 assignB(c); 64 } 65 66 public String retrieveB() { 67 BLocal lejbB = getB(); 68 if (lejbB == null) { 69 logger.log(BasicLevel.DEBUG, "return null"); 70 return null; 71 } else { 72 logger.log(BasicLevel.DEBUG, "return " + lejbB.getId()); 73 return lejbB.getId(); 74 } 75 } 76 77 public String retrieveBInNewTx() { 78 return retrieveB(); 79 } 80 81 public abstract String getId(); 85 public abstract void setId(String id); 86 87 public abstract BLocal getB(); 88 public abstract void setB(BLocal bl); 89 90 public abstract BLocal getBBis(); 91 public abstract void setBBis(BLocal bl); 92 93 97 static protected Logger logger = null; 98 EntityContext ejbContext; 99 100 106 public String ejbCreate(String id) throws CreateException , DuplicateKeyException { 107 logger.log(BasicLevel.DEBUG, ""); 108 109 setId(id); 111 112 return null; 114 } 115 116 126 public void setEntityContext(EntityContext ctx) { 127 if (logger == null) 128 logger = Log.getLogger(Log.JONAS_TESTS_PREFIX); 129 logger.log(BasicLevel.DEBUG, ""); 130 ejbContext = ctx; 131 try { 132 Context ictx = new InitialContext (); 133 bhl = (BHomeLocal) ictx.lookup("java:comp/env/ejb/b"); 134 } catch (NamingException e) { 135 throw new EJBException ("Impossible to fetch the ", e); 136 } 137 } 138 139 150 public void unsetEntityContext() { 151 logger.log(BasicLevel.DEBUG, ""); 152 ejbContext = null; 153 } 154 155 168 public void ejbRemove() throws RemoveException { 169 logger.log(BasicLevel.DEBUG, ""); 170 } 171 172 180 public void ejbLoad() { 181 logger.log(BasicLevel.DEBUG, ""); 182 } 183 184 192 public void ejbStore() { 193 logger.log(BasicLevel.DEBUG, ""); 194 } 195 196 201 public void ejbPostCreate(String id) throws CreateException { 202 logger.log(BasicLevel.DEBUG, "id=" + id); 203 } 204 205 209 public void ejbPassivate() { 210 logger.log(BasicLevel.DEBUG, ""); 211 } 212 213 218 public void ejbActivate() { 219 logger.log(BasicLevel.DEBUG, ""); 220 } 221 222 } 223 | Popular Tags |