1 6 package org.jfox.ejb.meta; 7 8 import org.jfox.ioc.util.XMLUtils; 9 import org.w3c.dom.Node ; 10 11 14 15 public class SessionDescriptor extends EJBDescriptor { 16 public static final String STATEFUL_SESSION = "Stateful"; 17 public static final String STATELESS_SESSION = "Stateless"; 18 private String sessionType; 19 20 public SessionDescriptor() { 21 } 22 23 public void processXML(Node node) throws EJBDescriptionException { 24 setHomeClassName(XMLUtils.getChildNodeValueOf(node, "home")); 25 setRemoteClassName(XMLUtils.getChildNodeValueOf(node, "remote")); 26 setSessionType(XMLUtils.getChildNodeValueOf(node, "session-type")); 27 super.processXML(node); 28 } 29 30 public String getSessionType() { 31 return sessionType; 32 } 33 34 public String getType() { 35 return "Session"; 36 } 37 38 public boolean isStateless() { 39 return STATELESS_SESSION.equals(sessionType); 40 } 41 42 public void setSessionType(String type) { 43 if(!STATEFUL_SESSION.equals(type) && !STATELESS_SESSION.equals(type)) { 44 throw new IllegalArgumentException ("session-type must be one of \"Stateful\" and \"Stateless\""); 45 } 46 sessionType = type; 47 } 48 49 50 public static void main(String [] args) { 51 52 } 53 } 54 55 | Popular Tags |