1 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 } 33 34 public void ejbActivate() 35 { 36 } 38 39 public void ejbPassivate() 40 { 41 } 43 44 public void ejbRemove() 45 { 46 } 48 49 public void setSessionContext(SessionContext sessionContext) 50 { 51 this.sessionContext = sessionContext; 52 } 53 54 public String reverse(String textToReverse) 55 { 56 if (textToReverse == null) 57 { 58 return null; 59 } 60 61 StringBuffer reversed = new StringBuffer (); 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 |