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