001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.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: SimpleSessionSL.java 3845 2003-12-05 14:19:55Z legrasi $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.beans.flocal;
027:
028: import java.sql.Connection;
029: import java.sql.SQLException;
030: import java.sql.Statement;
031: import javax.ejb.CreateException;
032: import javax.ejb.EJBException;
033: import javax.ejb.RemoveException;
034: import javax.ejb.EJBObject;
035: import javax.ejb.SessionBean;
036: import javax.ejb.SessionContext;
037: import javax.naming.Context;
038: import javax.naming.InitialContext;
039: import javax.naming.NamingException;
040:
041: /**
042: * Stateless Session
043: * @author Philippe Durieux
044: */
045: public class SimpleSessionSL implements SessionBean {
046:
047: SessionContext ejbContext;
048:
049: public String string;
050: public int number;
051: public boolean createdViaCreateXX;
052: public boolean createdViaCreateYY;
053:
054: // ------------------------------------------------------------------
055: // SessionBean implementation
056: // ------------------------------------------------------------------
057:
058: /**
059: * Set the associated session context. The container calls this method
060: * after the instance creation.
061: * The enterprise Bean instance should store the reference to the context
062: * object in an instance variable.
063: * This method is called with no transaction context.
064: *
065: * @param sessionContext A SessionContext interface for the instance.
066: * @throws EJBException Thrown by the method to indicate a failure caused by
067: * a system-level error.
068: */
069: public void setSessionContext(SessionContext ctx) {
070:
071: ejbContext = ctx;
072: }
073:
074: /**
075: * A container invokes this method before it ends the life of the session object.
076: * This happens as a result of a client's invoking a remove operation, or when a
077: * container decides to terminate the session object after a timeout.
078: * This method is called with no transaction context.
079: *
080: * @throws EJBException Thrown by the method to indicate a failure caused by
081: * a system-level error.
082: */
083: public void ejbRemove() {
084:
085: }
086:
087: /**
088: * The Session bean must define 1 or more ejbCreate methods.
089: *
090: * @throws CreateException Failure to create a session EJB object.
091: */
092: public void ejbCreate() throws CreateException {
093:
094: }
095:
096: /**
097: * A container invokes this method on an instance before the instance
098: * becomes disassociated with a specific EJB object.
099: */
100: public void ejbPassivate() {
101:
102: }
103:
104: /**
105: * A container invokes this method when the instance is taken out of
106: * the pool of available instances to become associated with a specific
107: * EJB object.
108: */
109: public void ejbActivate() {
110:
111: }
112:
113: // ------------------------------------------------------------------
114: // Target implementation
115: // ------------------------------------------------------------------
116:
117: /**
118: * getTen
119: */
120: public int getTen() {
121:
122: return 10;
123: }
124:
125: /**
126: * method2
127: */
128: public void method2(java.lang.String s) {
129:
130: }
131:
132: /**
133: * getNumber
134: * Not called
135: */
136: public int getNumber() {
137:
138: return 0;
139: }
140:
141: /**
142: * getString
143: * Not called
144: */
145: public String getString() {
146:
147: return null;
148: }
149:
150: /**
151: * isCreatedViaCreateXX
152: * Not called
153: */
154: public boolean isCreatedViaCreateXX() {
155:
156: return false;
157: }
158:
159: }
|