KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ejb > meta > SessionDescriptor


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6 package org.jfox.ejb.meta;
7
8 import org.jfox.ioc.util.XMLUtils;
9 import org.w3c.dom.Node JavaDoc;
10
11 /**
12  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
13  */

14
15 public class SessionDescriptor extends EJBDescriptor {
16     public static final String JavaDoc STATEFUL_SESSION = "Stateful";
17     public static final String JavaDoc STATELESS_SESSION = "Stateless";
18     private String JavaDoc sessionType;
19
20     public SessionDescriptor() {
21     }
22
23     public void processXML(Node JavaDoc 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 JavaDoc getSessionType() {
31         return sessionType;
32     }
33
34     public String JavaDoc getType() {
35         return "Session";
36     }
37
38     public boolean isStateless() {
39         return STATELESS_SESSION.equals(sessionType);
40     }
41
42     public void setSessionType(String JavaDoc type) {
43         if(!STATEFUL_SESSION.equals(type) && !STATELESS_SESSION.equals(type)) {
44             throw new IllegalArgumentException JavaDoc("session-type must be one of \"Stateful\" and \"Stateless\"");
45         }
46         sessionType = type;
47     }
48
49
50     public static void main(String JavaDoc[] args) {
51
52     }
53 }
54
55
Popular Tags