KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > acme > MagicGBallBean


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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: 476061 $ $Date: 2006-11-17 01:36:50 -0500 (Fri, 17 Nov 2006) $
23  */

24 public class MagicGBallBean implements javax.ejb.SessionBean JavaDoc {
25
26     private static final String JavaDoc[] 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 JavaDoc ask(String JavaDoc question){
29         return answers[Math.abs(question.hashCode()) % answers.length];
30     }
31     
32     private javax.ejb.SessionContext JavaDoc mySessionCtx;
33     /**
34      * getSessionContext
35      */

36     public javax.ejb.SessionContext JavaDoc getSessionContext() {
37         return mySessionCtx;
38     }
39     /**
40      * setSessionContext
41      */

42     public void setSessionContext(javax.ejb.SessionContext JavaDoc ctx) {
43         mySessionCtx = ctx;
44     }
45     /**
46      * ejbCreate
47      */

48     public void ejbCreate() throws javax.ejb.CreateException JavaDoc {
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 }
66
Popular Tags