KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > applis > ejb > perfs > PerfsBean


1
2 package applis.ejb.perfs;
3
4 import java.rmi.RemoteException;
5 import javax.ejb.EntityBean;
6 import javax.ejb.EntityContext;
7 import javax.ejb.RemoveException;
8 import javax.ejb.CreateException;
9
10 import org.objectweb.jonas.common.Log;
11 import org.objectweb.util.monolog.api.Logger;
12 import org.objectweb.util.monolog.api.BasicLevel;
13
14 public class PerfsBean implements EntityBean {
15  
16     static protected Logger logger = null;
17
18     protected EntityContext entityContext;
19
20     public int code = 0;
21     public String value = null;
22
23     public PerfsBeanPK ejbCreate(int i, String s) throws CreateException, RemoteException {
24     code = i;
25     value = s;
26     // In CMP, should return null.
27
return null;
28     }
29
30     public void ejbPostCreate(int i, String s) throws CreateException, RemoteException {
31     }
32
33     public void ejbActivate() throws RemoteException {
34     }
35
36     public void ejbPassivate() throws RemoteException {
37     }
38
39     public void ejbLoad() throws RemoteException {
40     }
41
42     public void ejbStore() throws RemoteException {
43     }
44   
45     public void ejbRemove() throws RemoveException{
46     }
47
48     public void setEntityContext(EntityContext ctx) {
49         if (logger == null)
50             logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
51         logger.log(BasicLevel.DEBUG, "");
52         entityContext = ctx;
53     }
54
55     public void unsetEntityContext() {
56     }
57
58     public String read() throws RemoteException {
59         logger.log(BasicLevel.DEBUG, "value = "+value);
60         return value;
61     }
62
63     public void write(String v) throws RemoteException {
64         logger.log(BasicLevel.DEBUG, "value = "+v);
65         value = new String(v);
66     }
67
68     public String txread() throws RemoteException {
69         logger.log(BasicLevel.DEBUG, "value = "+value);
70         return value;
71     }
72
73     public void txwrite(String v) throws RemoteException {
74         logger.log(BasicLevel.DEBUG, "value = "+v);
75         value = new String(v);
76     }
77
78 }
79
80
Popular Tags