1 17 18 package org.acme; 19 24 public class MagicGBallBean implements javax.ejb.SessionBean { 25 26 private static final String [] 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 ask(String question){ 29 return answers[Math.abs(question.hashCode()) % answers.length]; 30 } 31 32 private javax.ejb.SessionContext mySessionCtx; 33 36 public javax.ejb.SessionContext getSessionContext() { 37 return mySessionCtx; 38 } 39 42 public void setSessionContext(javax.ejb.SessionContext ctx) { 43 mySessionCtx = ctx; 44 } 45 48 public void ejbCreate() throws javax.ejb.CreateException { 49 } 50 53 public void ejbActivate() { 54 } 55 58 public void ejbPassivate() { 59 } 60 63 public void ejbRemove() { 64 } 65 } 66 | Popular Tags |