KickJava   Java API By Example, From Geeks To Geeks.

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


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 abstract class Perfs2Bean implements EntityBean {
15
16     static protected Logger logger = null;
17
18     protected EntityContext entityContext;
19
20     public abstract String getValue();
21     public abstract void setValue(String v);
22     public abstract int getCode();
23     public abstract void setCode(int v);
24
25     public PerfsBeanPK ejbCreate(int i, String s) throws CreateException, RemoteException {
26         setCode(i);
27         setValue(s);
28         // In CMP, should return null.
29
return null;
30     }
31
32     public void ejbPostCreate(int i, String s) throws CreateException, RemoteException {
33     }
34
35     public void ejbActivate() throws RemoteException {
36     }
37
38     public void ejbPassivate() throws RemoteException {
39     }
40
41     public void ejbLoad() throws RemoteException {
42     }
43
44     public void ejbStore() throws RemoteException {
45     }
46   
47     public void ejbRemove() throws RemoveException{
48     }
49
50     public void setEntityContext(EntityContext ctx) {
51         if (logger == null)
52             logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
53         logger.log(BasicLevel.DEBUG, "");
54         entityContext = ctx;
55     }
56
57     public void unsetEntityContext() {
58
59     }
60
61     public String read() throws RemoteException {
62         logger.log(BasicLevel.DEBUG, "value = "+getValue());
63         return getValue();
64     }
65
66     public void write(String value) throws RemoteException {
67         logger.log(BasicLevel.DEBUG, "value = "+getValue());
68         setValue(new String(value));
69     }
70
71     public String txread() throws RemoteException {
72         logger.log(BasicLevel.DEBUG, "value = "+getValue());
73         return getValue();
74     }
75
76     public void txwrite(String value) throws RemoteException {
77         logger.log(BasicLevel.DEBUG, "value = "+getValue());
78         setValue(new String(value));
79     }
80
81 }
82
83
Popular Tags