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: TargetSL.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, Philippe Coq
044: */
045: public class TargetSL implements SessionBean {
046:
047: // static protected Logger logger = null;
048: SessionContext ejbContext;
049:
050: public String string;
051: public int number;
052: public boolean createdViaCreateXX;
053: public boolean createdViaCreateYY;
054:
055: // ------------------------------------------------------------------
056: // SessionBean implementation
057: // ------------------------------------------------------------------
058:
059: /**
060: * Set the associated session context. The container calls this method
061: * after the instance creation.
062: * The enterprise Bean instance should store the reference to the context
063: * object in an instance variable.
064: * This method is called with no transaction context.
065: *
066: * @param sessionContext A SessionContext interface for the instance.
067: * @throws EJBException Thrown by the method to indicate a failure caused by
068: * a system-level error.
069: */
070: public void setSessionContext(SessionContext ctx) {
071: //if (logger == null)
072: //logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
073: //logger.log(BasicLevel.DEBUG, "");
074: ejbContext = ctx;
075: }
076:
077: /**
078: * A container invokes this method before it ends the life of the session object.
079: * This happens as a result of a client's invoking a remove operation, or when a
080: * container decides to terminate the session object after a timeout.
081: * This method is called with no transaction context.
082: *
083: * @throws EJBException Thrown by the method to indicate a failure caused by
084: * a system-level error.
085: */
086: public void ejbRemove() {
087: //logger.log(BasicLevel.DEBUG, "");
088: }
089:
090: /**
091: * The Session bean must define 1 or more ejbCreate methods.
092: *
093: * @throws CreateException Failure to create a session EJB object.
094: */
095: public void ejbCreate() throws CreateException {
096: //logger.log(BasicLevel.DEBUG, "");
097: }
098:
099: /**
100: * A container invokes this method on an instance before the instance
101: * becomes disassociated with a specific EJB object.
102: */
103: public void ejbPassivate() {
104: //logger.log(BasicLevel.DEBUG, "");
105: }
106:
107: /**
108: * A container invokes this method when the instance is taken out of
109: * the pool of available instances to become associated with a specific
110: * EJB object.
111: */
112: public void ejbActivate() {
113: //logger.log(BasicLevel.DEBUG, "");
114: }
115:
116: // ------------------------------------------------------------------
117: // LocalInterface implementation
118: // ------------------------------------------------------------------
119:
120: /**
121: * getTwenty
122: */
123: public int getTwenty() {
124: //logger.log(BasicLevel.DEBUG, "");
125: return 20;
126: }
127:
128: /**
129: * lmethod2
130: */
131: public void lmethod2(java.lang.String s) {
132: //logger.log(BasicLevel.DEBUG, "");
133: }
134:
135: // ------------------------------------------------------------------
136: // Target implementation
137: // ------------------------------------------------------------------
138:
139: /**
140: * getTen
141: */
142: public int getTen() {
143: //logger.log(BasicLevel.DEBUG, "");
144: return 10;
145: }
146:
147: /**
148: * method2
149: */
150: public void method2(java.lang.String s) {
151: //logger.log(BasicLevel.DEBUG, "");
152: }
153:
154: /**
155: * getNumber
156: * Not called
157: */
158: public int getNumber() {
159: //logger.log(BasicLevel.DEBUG, "");
160: return 0;
161: }
162:
163: /**
164: * getString
165: * Not called
166: */
167: public String getString() {
168: //logger.log(BasicLevel.DEBUG, "");
169: return null;
170: }
171:
172: /**
173: * isCreatedViaCreateXX
174: * Not called
175: */
176: public boolean isCreatedViaCreateXX() {
177: //logger.log(BasicLevel.DEBUG, "");
178: return false;
179: }
180:
181: }
|