View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  
18  package org.acme;
19  /**
20   * Bean implementation class for Enterprise Bean: MagicGBall
21   *
22   * @version $Rev: 411947 $ $Date: 2006-06-05 16:26:17 -0700 (Mon, 05 Jun 2006) $
23   */
24  public class MagicGBallBean implements javax.ejb.SessionBean {
25  
26  	private static final String[] answers = {"It is certain","Outlook not so good","You may rely on it","My Sources say no","It is decidedly so", "Rephrase and ask again","Most likely","Don't count on it","Yes definitely","Very doubtful"}; 
27  
28  	public String ask(String question){
29  		return answers[Math.abs(question.hashCode()) % answers.length];
30  	}
31  	
32  	private javax.ejb.SessionContext mySessionCtx;
33  	/**
34  	 * getSessionContext
35  	 */
36  	public javax.ejb.SessionContext getSessionContext() {
37  		return mySessionCtx;
38  	}
39  	/**
40  	 * setSessionContext
41  	 */
42  	public void setSessionContext(javax.ejb.SessionContext ctx) {
43  		mySessionCtx = ctx;
44  	}
45  	/**
46  	 * ejbCreate
47  	 */
48  	public void ejbCreate() throws javax.ejb.CreateException {
49  	}
50  	/**
51  	 * ejbActivate
52  	 */
53  	public void ejbActivate() {
54  	}
55  	/**
56  	 * ejbPassivate
57  	 */
58  	public void ejbPassivate() {
59  	}
60  	/**
61  	 * ejbRemove
62  	 */
63  	public void ejbRemove() {
64  	}
65  }