KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateful > containermanaged > ejb2view > SimpleEjb2LifecycleBean


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: SimpleEjb2LifecycleBean.java 831 2006-07-11 11:23:08Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view;
26
27 import java.rmi.RemoteException JavaDoc;
28
29 import javax.ejb.CreateException JavaDoc;
30 import javax.ejb.EJB JavaDoc;
31 import javax.ejb.EJBException JavaDoc;
32 import javax.ejb.Init JavaDoc;
33 import javax.ejb.Local JavaDoc;
34 import javax.ejb.LocalHome JavaDoc;
35 import javax.ejb.Remote JavaDoc;
36 import javax.ejb.RemoteHome JavaDoc;
37 import javax.ejb.SessionBean JavaDoc;
38 import javax.ejb.SessionContext JavaDoc;
39 import javax.ejb.Stateful JavaDoc;
40
41 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
42 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
43
44 /**
45  * Bean that provides a ejb 2.1 view.
46  * @author Gisele Pinheiro Souza
47  * @author Eduardo Studzinski Estima de Castro
48  *
49  */

50 @Stateful JavaDoc(name = "SimpleEjb2LifecycleBean")
51 @Remote JavaDoc(SimpleEjb2.class)
52 @Local JavaDoc(SimpleEjb2Local.class)
53 @RemoteHome JavaDoc(SimpleEjb2Home.class)
54 @LocalHome JavaDoc(SimpleEjb2LocalHome.class)
55 public class SimpleEjb2LifecycleBean extends SimpleEjb2BeanBase implements SessionBean JavaDoc {
56
57     /**
58      * Serial id.
59      */

60     private static final long serialVersionUID = 3594789527580608168L;
61
62     /**
63      * Bean used to log the callback loger.
64      */

65     @EJB JavaDoc(beanName = "SLSBCallbackLoggerAccess")
66     private ItfCallbackLoggerAccess clBean;
67
68     /**
69      * Creates an instance of the bean with the values in the parameters.
70      * @param code the bean code.
71      * @param name the bean name.
72      * @throws CreateException if an error during the creation occurs
73      * @throws RemoteException if a system level error occurs.
74      */

75     @Override JavaDoc
76     @Init JavaDoc
77     public void init(final int code, final String JavaDoc name) throws CreateException JavaDoc, RemoteException JavaDoc {
78         super.init(code, name);
79     }
80
81     /**
82      * Creates an instance of the bean with the default code and the name
83      * defined in the parameter.
84      * @param name the bean name.
85      * @throws CreateException if a creation error occurs.
86      */

87     @Override JavaDoc
88     @Init JavaDoc
89     void init(final String JavaDoc name) throws CreateException JavaDoc {
90         super.init(name);
91     }
92
93     /**
94      * Called when the bean is activated.
95      * @throws EJBException if a system level error occurs.
96      * @throws RemoteException defined to provive compatibility among the versions.
97      */

98     public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc {
99         // TODO How to test the ejbActivate?
100
}
101
102     /**
103      * Called when the bean goes to passivate state.
104      * @throws EJBException if a system level error occurs.
105      * @throws RemoteException defined to provive compatibility among the versions.
106      */

107     public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc {
108         // TODO How to test the ejbPassivate?
109

110     }
111
112     /**
113      * Inserts the call in the log.
114      * @throws EJBException if a system level error occurs.
115      * @throws RemoteException defined to provive compatibility among the versions.
116      */

117     public void ejbRemove() throws EJBException JavaDoc, RemoteException JavaDoc {
118         clBean.insertCallbackLogger(this.getClass().getName(), CallbackType.PRE_DESTROY, this.getClass().getName());
119     }
120
121     /**
122      * Sets the session context.
123      * @param arg0 the session context.
124      * @throws EJBException if a system level error occurs.
125      * @throws RemoteException defined to provive compatibility among the versions.
126      */

127     public void setSessionContext(final SessionContext JavaDoc arg0) throws EJBException JavaDoc, RemoteException JavaDoc {
128
129     }
130 }
131
Popular Tags