1 45 package org.openejb.webadmin.httpd; 46 47 import java.util.HashMap ; 48 49 import javax.ejb.CreateException ; 50 import javax.ejb.SessionBean ; 51 import javax.ejb.SessionContext ; 52 53 import org.openejb.core.stateful.StatefulEjbObjectHandler; 54 import org.openejb.util.proxy.ProxyManager; 55 56 59 public class WebSessionBean implements SessionBean { 60 61 private SessionContext ctx; 62 private HashMap attributes; 63 64 public void ejbCreate() throws CreateException { 65 attributes = new HashMap (); 66 } 67 68 public String getId() { 69 Object obj = ProxyManager.getInvocationHandler(ctx.getEJBObject()); 70 StatefulEjbObjectHandler handler = (StatefulEjbObjectHandler) obj; 71 return handler.getRegistryId() + ""; 72 } 73 74 84 public Object getAttribute(String name) { 85 return attributes.get(name); 86 } 87 88 public void setAttribute(String name, Object value) { 89 attributes.put(name, value); 90 } 91 92 public void removeAttribute(String name) { 93 attributes.remove(name); 94 } 95 96 public void ejbActivate() { 97 98 } 99 100 public void ejbPassivate() { 101 102 } 103 104 public void ejbRemove() { 105 106 } 107 108 public void setSessionContext(SessionContext ctx) { 109 this.ctx = ctx; 110 } 111 } 112 | Popular Tags |