KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateless > containermanaged > sbinterface > SLSBSessionBeanInterface00


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: SLSBSessionBeanInterface00.java 692 2006-06-20 09:17:57Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateless.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.SessionBean JavaDoc;
33 import javax.ejb.SessionContext JavaDoc;
34 import javax.ejb.Stateless JavaDoc;
35
36 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck01;
37 import org.objectweb.easybeans.tests.common.ejbs.base.ItfOneMethod01;
38 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
39 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertCallbackEvent;
40
41 /**
42  * This class is used as base to test the sessionbean interface.
43  * @author Eduardo Studzinski Estima de Castro
44  * @author Gisele Pinheiro Souza
45  */

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

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

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

66     public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc {
67     }
68
69     /**
70      * ejbPassivate method.
71      * @throws EJBException if a problem occurs.
72      * @throws RemoteException if a problem occurs.
73      */

74     public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc {
75     }
76
77     /**
78      * ejbRemove method.
79      * @throws EJBException if a problem occurs.
80      * @throws RemoteException if a problem occurs.
81      */

82     public void ejbRemove() throws EJBException JavaDoc, RemoteException JavaDoc {
83         //TODO: test case
84
super.log(SLSBSessionBeanInterface00.class.getName(), CallbackType.PRE_DESTROY,
85                 SLSBSessionBeanInterface00.class.getName());
86     }
87
88     /**
89      * Sets the SessionContext.
90      * @param ctx SessionContext
91      * @throws EJBException if a problem occurs.
92      * @throws RemoteException if a problem occurs.
93      */

94     public void setSessionContext(final SessionContext JavaDoc ctx) throws EJBException JavaDoc, RemoteException JavaDoc {
95         this.ctx = ctx;
96     }
97
98     /**
99      * Check the SessionContext.
100      * @throws Exception if a problem occurs.
101      */

102     public void check() throws Exception JavaDoc {
103         if (ctx != null) {
104             ItfOneMethod01 bean = (ItfOneMethod01) ctx.lookup("ejb/bean00");
105             bean.getBool();
106         } else {
107             throw new Exception JavaDoc("SessionContext should be initialized.");
108         }
109     }
110
111 }
112
Popular Tags