1 22 package org.jboss.ejb3.test.reference21_30; 23 24 import javax.ejb.Init ; 25 import javax.ejb.Local ; 26 import javax.ejb.LocalHome ; 27 import javax.annotation.PreDestroy; 28 import javax.ejb.Remote ; 29 import javax.ejb.RemoteHome ; 30 import javax.ejb.Stateful ; 31 import javax.naming.InitialContext ; 32 import org.jboss.annotation.ejb.LocalBinding; 33 import org.jboss.annotation.ejb.RemoteBinding; 34 import org.jboss.logging.Logger; 35 36 40 @Stateful (name="HomedStatefulSession30") 41 @RemoteHome (StatefulSession30Home.class) 42 @LocalHome (StatefulSession30LocalHome.class) 43 @Local (LocalStatefulSession30.class) 44 @Remote (StatefulSession30.class) 45 @RemoteBinding(jndiBinding = "HomedStatefulSession30") 46 @LocalBinding(jndiBinding = "HomedLocalStatefulSession30") 47 public class HomedStatefulSession30Bean implements java.io.Serializable 48 { 49 private static final Logger log = Logger.getLogger(HomedStatefulSession30Bean.class); 50 51 private String value = null; 52 53 public void setValue(String value) 54 { 55 this.value = value; 56 } 57 58 public String getValue() 59 { 60 return value; 61 } 62 63 public void setLocalValue(String value) 64 { 65 this.value = value; 66 } 67 68 public String getLocalValue() 69 { 70 return value; 71 } 72 73 public String accessLocalStateless() 74 { 75 try { 76 InitialContext jndiContext = new InitialContext (); 77 Session30LocalHome localHome = (Session30LocalHome)jndiContext.lookup("LocalSession30"); 78 LocalSession30 localSession = localHome.create(); 79 return localSession.access(); 80 } catch (Exception e) 81 { 82 e.printStackTrace(); 83 return null; 84 } 85 } 86 87 @Init 88 public void ejbCreate() 89 { 90 value="default"; 91 } 92 93 @Init 94 public void ejbCreate(String value) 95 { 96 this.value=value; 97 } 98 99 @Init 100 public void ejbCreate(String value, Integer suffix) 101 { 102 this.value=value + suffix; 103 } 104 105 @PreDestroy 106 public void preDestroy() 107 { 108 log.info("Invoking PreDestroy"); 109 } 110 } 111 | Popular Tags |