public class HelloBean implements SessionBean { static final boolean verbose = true;
private transient SessionContext ctx;
// Implement the methods in the SessionBean // interface public void ejbActivate() { if (verbose) System.out.println("ejbActivate called"); }
public void ejbRemove() { if (verbose) System.out.println("ejbRemove called"); }
public void ejbPassivate() { if (verbose) System.out.println("ejbPassivate called"); }
/** * Sets the session context. * * @param SessionContext */ public void setSessionContext(SessionContext ctx) { if (verbose) System.out.println("setSessionContext called"); this.ctx = ctx; }
/** * This method corresponds to the create method in * the home interface HelloHome.java. * The parameter sets of the two methods are * identical. When the client calls * HelloHome.create(), the container allocates an * instance of the EJBean and calls ejbCreate(). */ public void ejbCreate () { if (verbose) System.out.println("ejbCreate called"); } /** * **** HERE IS THE BUSINESS LOGIC ***** * the getHello just return a "Hello World" string. */ public String getHello() throws RemoteException { return("Hello World"); } }