KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > hotdeploy > HotDeploySLR


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

4 package org.objectweb.jonas.jtests.beans.hotdeploy;
5
6 import java.rmi.RemoteException;
7 import java.sql.Connection;
8 import java.sql.SQLException;
9 import java.sql.Statement;
10 import javax.ejb.CreateException;
11 import javax.ejb.EJBException;
12 import javax.ejb.RemoveException;
13 import javax.ejb.EJBObject;
14 import javax.ejb.SessionBean;
15 import javax.ejb.SessionContext;
16 import javax.naming.Context;
17 import javax.naming.InitialContext;
18 import javax.naming.NamingException;
19 import javax.sql.DataSource;
20
21 import org.objectweb.jonas.common.Log;
22 import org.objectweb.util.monolog.api.Logger;
23 import org.objectweb.util.monolog.api.BasicLevel;
24
25
26 /**
27  *
28  */

29 public class HotDeploySLR implements SessionBean {
30
31     static private Logger logger = null;
32     SessionContext ejbContext;
33     private static final int VERSION_NUMBER = 2;
34
35     // ------------------------------------------------------------------
36
// SessionBean implementation
37
// ------------------------------------------------------------------
38

39
40     public void setSessionContext(SessionContext ctx) {
41         if (logger == null) {
42             logger = Log.getLogger("org.objectweb.jonas_tests");
43         }
44         logger.log(BasicLevel.DEBUG, "");
45         ejbContext = ctx;
46     }
47         
48
49     public void ejbRemove() {
50         logger.log(BasicLevel.DEBUG, "");
51     }
52         
53
54     public void ejbCreate() throws CreateException {
55         logger.log(BasicLevel.DEBUG, "");
56     }
57
58     public void ejbPassivate() {
59         logger.log(BasicLevel.DEBUG, "");
60     }
61
62     public void ejbActivate() {
63         logger.log(BasicLevel.DEBUG, "");
64     }
65     
66     // ------------------------------------------------------------------
67
// HotDeploy implementation
68
// ------------------------------------------------------------------
69
/**
70      * method1
71      */

72     public String getEnvString() {
73         logger.log(BasicLevel.DEBUG, "getEnvString");
74         String value = "";
75         try {
76             InitialContext ictx = new InitialContext();
77             value = (String) ictx.lookup("java:comp/env/name");
78             // value should be the one defined in ejb-jar.xml
79
} catch (NamingException e) {
80             throw new EJBException(e);
81         }
82        
83         return value;
84     }
85
86     public int getVersionNumber() {
87         logger.log(BasicLevel.DEBUG, "getVersionNumber = " + VERSION_NUMBER);
88         return VERSION_NUMBER;
89     }
90
91     public int getHelperClassVersionNumber() {
92         logger.log(BasicLevel.DEBUG, "getHelperClassVersionNumber = " + Helper.VERSION_NUMBER);
93         return Helper.VERSION_NUMBER;
94     }
95
96 }
97
98
Popular Tags