KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > mcontext > BeanAccessorSLR


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

4 package org.objectweb.jonas.jtests.beans.mcontext;
5
6 import javax.ejb.CreateException JavaDoc;
7 import javax.ejb.SessionBean JavaDoc;
8 import javax.ejb.SessionContext JavaDoc;
9 import javax.naming.Context JavaDoc;
10 import javax.naming.InitialContext 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  */

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

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

60     /**
61      * method1
62      */

63     public boolean localBeanHasMessageContext() {
64         logger.log(BasicLevel.DEBUG, "");
65         try {
66             Context JavaDoc ctx = new InitialContext JavaDoc();
67             TestMC1LocalHome home = (TestMC1LocalHome) ctx.lookup("TestMC1Home_L");
68             TestMC1Local mc1 = home.create();
69             return mc1.localMethodHasMessageContext();
70         } catch (Exception JavaDoc e) {
71             logger.log(BasicLevel.WARN, "Something goes wrong");
72         }
73         return true;
74     }
75
76 }
77
78
Popular Tags