KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateful > containermanaged > sbinterface > SFSBSessionBeanItf


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$
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.sbinterface;
26
27 import java.rmi.RemoteException JavaDoc;
28
29 import javax.ejb.EJB JavaDoc;
30 import javax.ejb.EJBException JavaDoc;
31 import javax.ejb.Remote JavaDoc;
32 import javax.ejb.Remove JavaDoc;
33 import javax.ejb.SessionBean JavaDoc;
34 import javax.ejb.SessionContext JavaDoc;
35 import javax.ejb.Stateful JavaDoc;
36
37 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck02;
38 import org.objectweb.easybeans.tests.common.ejbs.base.ItfOneMethod01;
39 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
40 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertCallbackEvent;
41
42 /**
43  * This class is used as base to test the sessionbean interface.
44  * @author Eduardo Studzinski Estima de Castro
45  * @author Gisele Pinheiro Souza
46  */

47 @Stateful JavaDoc(name = "SFSBSessionBeanItf")
48 @Remote JavaDoc(ItfCheck02.class)
49 @EJB JavaDoc(name = "ejb/bean00", beanName = "EJBInjectionBean", beanInterface = ItfOneMethod01.class)
50 public class SFSBSessionBeanItf extends BaseInsertCallbackEvent implements SessionBean JavaDoc, ItfCheck02 {
51
52     /**
53      * ID.
54      */

55     private static final long serialVersionUID = 1L;
56
57     /**
58      * SessionContext.
59      */

60     private SessionContext JavaDoc ctx;
61
62     /**
63      * ejbActivate method.
64      * @throws EJBException if a problem occurs.
65      * @throws RemoteException if a problem occurs.
66      */

67     public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc {
68         //TODO: test case
69
super.log(SFSBSessionBeanItf.class.getName(), CallbackType.POST_ACTIVATE,
70                 SFSBSessionBeanItf.class.getName());
71     }
72
73     /**
74      * ejbPassivate method.
75      * @throws EJBException if a problem occurs.
76      * @throws RemoteException if a problem occurs.
77      */

78     public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc {
79         //TODO: test case
80
super.log(SFSBSessionBeanItf.class.getName(), CallbackType.PRE_PASSIVATE,
81                 SFSBSessionBeanItf.class.getName());
82     }
83
84     /**
85      * ejbRemove method.
86      * @throws EJBException if a problem occurs.
87      * @throws RemoteException if a problem occurs.
88      */

89     public void ejbRemove() throws EJBException JavaDoc, RemoteException JavaDoc {
90         super.log(SFSBSessionBeanItf.class.getName(), CallbackType.PRE_DESTROY,
91                 SFSBSessionBeanItf.class.getName());
92     }
93
94     /**
95      * Sets the SessionContext.
96      * @param ctx SessionContext
97      * @throws EJBException if a problem occurs.
98      * @throws RemoteException if a problem occurs.
99      */

100     public void setSessionContext(final SessionContext JavaDoc ctx) throws EJBException JavaDoc, RemoteException JavaDoc {
101         this.ctx = ctx;
102     }
103
104     /**
105      * Check the SessionContext.
106      * @throws Exception if a problem occurs.
107      */

108     public void check() throws Exception JavaDoc {
109         if (ctx != null) {
110             ItfOneMethod01 bean = (ItfOneMethod01) ctx.lookup("ejb/bean00");
111             bean.getBool();
112         } else {
113             throw new Exception JavaDoc("SessionContext should be initialized.");
114         }
115     }
116
117     /**
118      * Bean remove.
119      */

120     @Remove JavaDoc
121     public void remove() {
122     }
123
124 }
125
Popular Tags