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: TargetSF.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: * Stateful Session
043: * @author Philippe Durieux, Philippe Coq
044: */
045: public class TargetSF extends TargetSL {
046:
047: public String string;
048: public int number;
049: public boolean createdViaCreateXX;
050: public boolean createdViaCreateYY;
051:
052: /**
053: * The Session bean must define 1 or more ejbCreate methods.
054: *
055: * @throws CreateException Failure to create a session EJB object.
056: */
057: public void ejbCreate() throws CreateException {
058: // logger.log(BasicLevel.DEBUG, "");
059: string = "";
060: number = 0;
061: createdViaCreateXX = false;
062: createdViaCreateYY = false;
063: }
064:
065: /**
066: * ejbCreate methods with parameter
067: *
068: * @throws CreateException Failure to create a session EJB object.
069: */
070: public void ejbCreate(String s, int n) throws CreateException {
071: // logger.log(BasicLevel.DEBUG, "");
072: string = s;
073: number = n;
074: createdViaCreateXX = false;
075: createdViaCreateYY = false;
076: }
077:
078: /**
079: * ejbCreate methods for a create<METHOD>
080: *
081: * @throws CreateException Failure to create a session EJB object.
082: */
083: public void ejbCreateXX(String s, int n) throws CreateException {
084: //logger.log(BasicLevel.DEBUG, "");
085: string = s;
086: number = n;
087: createdViaCreateXX = true;
088: createdViaCreateYY = false;
089: }
090:
091: /**
092: * ejbCreate methods for a Local create<METHOD>
093: *
094: * @throws CreateException Failure to create a session EJB object.
095: */
096: public void ejbCreateYY(String s, int n) throws CreateException {
097: //logger.log(BasicLevel.DEBUG, "");
098: string = s;
099: number = n;
100: createdViaCreateXX = false;
101: createdViaCreateYY = true;
102: }
103:
104: // ------------------------------------------------------------------
105: // Target implementation
106: // ------------------------------------------------------------------
107:
108: /**
109: * getNumber
110: */
111: public int getNumber() {
112: //logger.log(BasicLevel.DEBUG, "");
113: return number;
114: }
115:
116: /**
117: * getString
118: */
119: public String getString() {
120: //logger.log(BasicLevel.DEBUG, "");
121: return string;
122: }
123:
124: /**
125: * isCreatedViaCreateXX
126: */
127: public boolean isCreatedViaCreateXX() {
128: //logger.log(BasicLevel.DEBUG, "");
129: return createdViaCreateXX;
130: }
131:
132: // ------------------------------------------------------------------
133: // TargetLocal implementation
134: // ------------------------------------------------------------------
135:
136: /**
137: * isCreatedViaCreateYY
138: */
139: public boolean isCreatedViaCreateYY() {
140: //logger.log(BasicLevel.DEBUG, "");
141: return createdViaCreateYY;
142: }
143: }
|