1 19 package demo.ejb.client; 20 21 import javax.rmi.*; 22 import com.mentumgroup.jeenius.webclient.*; 23 import demo.ejb.interfaces.*; 24 25 public class ReverseBean extends EjbClient implements ActionBean 26 { 27 private String textToReverse; 28 private String reversedText; 29 30 34 public void initialise() throws ActionBeanException 35 { 36 } 38 39 43 public void execute() throws ActionBeanException 44 { 45 if (textToReverse == null || textToReverse.trim().length() < 1) 46 { 47 throw new ValidationException("Please enter some text to reverse."); 48 } 49 50 try 51 { 52 Object homeRef = getContext().lookup("demo.Reverser"); 53 54 ReverserHome home = (ReverserHome)PortableRemoteObject.narrow(homeRef,ReverserHome.class); 55 56 Reverser reverser = home.create(); 57 58 reversedText = reverser.reverse(textToReverse); 59 60 reverser.remove(); 61 } 62 catch(Exception e) 63 { 64 throw new FatalException("Unable to reverse string. Error was: " + e.getMessage() ); 65 } 66 } 67 68 69 72 public void setTextToReverse(java.lang.String textToReverse) 73 { 74 this.textToReverse = textToReverse; 75 } 76 77 80 public java.lang.String getReversedText() 81 { 82 return reversedText; 83 } 84 85 88 public java.lang.String getTextToReverse() 89 { 90 return textToReverse; 91 } 92 93 } 94 95 96 | Popular Tags |