1 25 26 package org.objectweb.jonas.jtests.beans.relation.dass; 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 51 public void assignB(String c) throws FinderException { 52 logger.log(BasicLevel.DEBUG, ""); 53 if (c != null) { 54 BLocal bl = null; 55 bl = bhl.findByPrimaryKey(c); 56 setB(bl); 57 } else 58 setB(null); 59 } 60 61 public String retrieveB() { 62 logger.log(BasicLevel.DEBUG, ""); 63 BLocal lejbB = getB(); 64 if (lejbB == null) { 65 return null; 66 } else { 67 return lejbB.getId(); 68 } 69 } 70 71 public abstract String getId(); 75 public abstract void setId(String id); 76 77 public abstract String getBcmrvalue(); 78 public abstract void setBcmrvalue(String id); 79 80 public abstract BLocal getB(); 81 public abstract void setB(BLocal bl); 82 83 84 88 static protected Logger logger = null; 89 EntityContext ejbContext; 90 91 97 public String ejbCreate(String id) throws CreateException , DuplicateKeyException { 98 logger.log(BasicLevel.DEBUG, ""); 99 100 setId(id); 102 103 return null; 105 } 106 107 112 public void ejbPostCreate(String id) throws CreateException { 113 logger.log(BasicLevel.DEBUG, "id=" + id); 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 200 public void ejbPassivate() { 201 logger.log(BasicLevel.DEBUG, ""); 202 } 203 204 209 public void ejbActivate() { 210 logger.log(BasicLevel.DEBUG, ""); 211 } 212 213 } 214 | Popular Tags |