1 22 package org.jboss.ejb3.test.iiop; 23 24 import java.rmi.RemoteException ; 25 26 import javax.annotation.PreDestroy; 27 import javax.ejb.CreateException ; 28 import javax.ejb.Init ; 29 import javax.ejb.Remote ; 30 import javax.ejb.RemoteHome ; 31 import javax.ejb.Remove ; 32 import javax.ejb.RemoveException ; 33 import javax.ejb.Stateful ; 34 35 import org.jboss.annotation.ejb.RemoteBinding; 36 import org.jboss.ejb3.iiop.IORFactory; 37 import org.jboss.logging.Logger; 38 39 45 @Stateful 46 @Remote (MyStateful.class) 47 @RemoteHome (MyStatefulHome.class) 48 @RemoteBinding(factory=IORFactory.class) 49 public class MyStatefulBean 50 { 51 private static final Logger log = Logger.getLogger(MyStatefulBean.class); 52 53 private String name; 54 55 @Init 56 public void ejbCreate() throws CreateException , RemoteException 57 { 58 name = "anonymous"; 59 } 60 61 @Init 62 public void ejbCreate(String name) throws CreateException , RemoteException 63 { 64 this.name = name; 65 } 66 67 @Remove 68 public void ejbRemove() throws RemoveException , RemoteException 69 { 70 log.info("remove bean"); 71 } 72 73 public String getName() throws RemoteException 74 { 75 return name; 76 } 77 78 @PreDestroy 79 public void preDestroy() 80 { 81 log.info("pre destroy"); 82 } 83 84 public String sayHello() throws RemoteException 85 { 86 return "Hello " + name; 87 } 88 89 public void setName(String name) throws RemoteException 90 { 91 this.name = name; 92 } 93 } 94 | Popular Tags |