001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: SLSBSessionBeanInterface00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.sbinterface;
025:
026: import java.rmi.RemoteException;
027:
028: import javax.ejb.EJB;
029: import javax.ejb.EJBException;
030: import javax.ejb.Remote;
031: import javax.ejb.SessionBean;
032: import javax.ejb.SessionContext;
033: import javax.ejb.Stateless;
034:
035: import org.ow2.easybeans.tests.common.ejbs.base.ItfCheck01;
036: import org.ow2.easybeans.tests.common.ejbs.base.ItfOneMethod01;
037: import org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType;
038: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.BaseInsertCallbackEvent;
039:
040: /**
041: * This class is used as base to test the sessionbean interface.
042: * @author Eduardo Studzinski Estima de Castro
043: * @author Gisele Pinheiro Souza
044: */
045: @Stateless(name="SLSBSessionBeanInterface00")
046: @Remote(ItfCheck01.class)
047: @EJB(name="ejb/bean00",beanName="EJBInjectionBean",beanInterface=ItfOneMethod01.class)
048: public class SLSBSessionBeanInterface00 extends BaseInsertCallbackEvent
049: implements SessionBean, ItfCheck01 {
050:
051: /**
052: * ID.
053: */
054: private static final long serialVersionUID = 1L;
055:
056: /**
057: * SessionContext.
058: */
059: private SessionContext ctx;
060:
061: /**
062: * ejbActivate method.
063: * @throws EJBException if a problem occurs.
064: * @throws RemoteException if a problem occurs.
065: */
066: public void ejbActivate() throws EJBException, RemoteException {
067: }
068:
069: /**
070: * ejbPassivate method.
071: * @throws EJBException if a problem occurs.
072: * @throws RemoteException if a problem occurs.
073: */
074: public void ejbPassivate() throws EJBException, RemoteException {
075: }
076:
077: /**
078: * ejbRemove method.
079: * @throws EJBException if a problem occurs.
080: * @throws RemoteException if a problem occurs.
081: */
082: public void ejbRemove() throws EJBException, RemoteException {
083: //TODO: test case
084: super .log(SLSBSessionBeanInterface00.class.getName(),
085: CallbackType.PRE_DESTROY,
086: SLSBSessionBeanInterface00.class.getName());
087: }
088:
089: /**
090: * Sets the SessionContext.
091: * @param ctx SessionContext
092: * @throws EJBException if a problem occurs.
093: * @throws RemoteException if a problem occurs.
094: */
095: public void setSessionContext(final SessionContext ctx)
096: throws EJBException, RemoteException {
097: this .ctx = ctx;
098: }
099:
100: /**
101: * Check the SessionContext.
102: * @throws Exception if a problem occurs.
103: */
104: public void check() throws Exception {
105: if (ctx != null) {
106: ItfOneMethod01 bean = (ItfOneMethod01) ctx
107: .lookup("ejb/bean00");
108: bean.getBool();
109: } else {
110: throw new Exception("SessionContext should be initialized.");
111: }
112: }
113:
114: }
|