KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > ejb > server > ReverserBean


1 /*
2  * Jeenius - a J2EE Framework
3  * Copyright (C) 2002 The Mentum Group
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package demo.ejb.server;
20
21 import javax.ejb.*;
22 import demo.ejb.interfaces.*;
23
24 public class ReverserBean implements ReverserInterface,SessionBean
25 {
26   private SessionContext sessionContext;
27
28
29   public void ejbCreate()
30   {
31     // do nothing
32
}
33
34   public void ejbActivate()
35   {
36     // do nothing
37
}
38
39   public void ejbPassivate()
40   {
41     // do
42
}
43
44   public void ejbRemove()
45   {
46     // do nothing
47
}
48
49   public void setSessionContext(SessionContext sessionContext)
50   {
51     this.sessionContext = sessionContext;
52   }
53
54   public String JavaDoc reverse(String JavaDoc textToReverse)
55   {
56     if (textToReverse == null)
57     {
58       return null;
59     }
60
61     StringBuffer JavaDoc reversed = new StringBuffer JavaDoc();
62     for (int loop=textToReverse.length()-1; loop >= 0; loop--)
63     {
64       reversed.append(textToReverse.charAt(loop));
65     }
66
67     return reversed.toString();
68   }
69
70 }
71
72
73
Popular Tags