KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > time > TimeBeanSLR


1 // TimeBeanSLR.java
2
// Stateless Session bean
3

4 package org.objectweb.jonas.jtests.beans.time;
5
6 import java.util.Date JavaDoc;
7
8 import javax.ejb.CreateException JavaDoc;
9 import javax.ejb.SessionBean JavaDoc;
10 import javax.ejb.SessionContext JavaDoc;
11
12 import org.objectweb.jonas.common.Log;
13 import org.objectweb.util.monolog.api.BasicLevel;
14 import org.objectweb.util.monolog.api.Logger;
15
16 /**
17  *
18  */

19 public class TimeBeanSLR implements SessionBean JavaDoc {
20
21     static private Logger logger = null;
22     SessionContext JavaDoc ejbContext;
23
24     // ------------------------------------------------------------------
25
// SessionBean implementation
26
// ------------------------------------------------------------------
27

28
29     public void setSessionContext(SessionContext JavaDoc ctx) {
30         if (logger == null) {
31             logger = Log.getLogger("org.objectweb.jonas_tests");
32         }
33         logger.log(BasicLevel.DEBUG, "");
34         ejbContext = ctx;
35     }
36         
37
38     public void ejbRemove() {
39         logger.log(BasicLevel.DEBUG, "");
40     }
41         
42
43     public void ejbCreate() throws CreateException JavaDoc {
44         logger.log(BasicLevel.DEBUG, "");
45     }
46
47     public void ejbPassivate() {
48         logger.log(BasicLevel.DEBUG, "");
49     }
50
51     public void ejbActivate() {
52         logger.log(BasicLevel.DEBUG, "");
53     }
54     
55     // ------------------------------------------------------------------
56
// TimeBean implementation
57
// ------------------------------------------------------------------
58

59     public long getDateAsLong() {
60         logger.log(BasicLevel.DEBUG, "");
61         return new Date JavaDoc().getTime();
62     }
63
64     public Date JavaDoc getDate() {
65         logger.log(BasicLevel.DEBUG, "");
66         return new Date JavaDoc();
67     }
68     
69     public boolean isHandlerInitRequestInvoked() {
70         logger.log(BasicLevel.DEBUG, "");
71         StaticPassValue spv = StaticPassValue.getInstance();
72         String JavaDoc init = spv.getInit();
73         String JavaDoc req = spv.getRequest();
74         return (init != null && req != null);
75     }
76 }
77
78
Popular Tags