KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > dd > SessionEnterpriseBean


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.ejb3.dd;
8
9 import javax.ejb.TransactionManagementType JavaDoc;
10
11 import org.jboss.ejb3.tx.TxUtil;
12 import org.jboss.logging.Logger;
13
14 /**
15  * Represents a Session EJB element of the ejb-jar.xml deployment descriptor for
16  * the 1.4 schema
17  *
18  * @version <tt>$Revision: 1.7.2.1 $</tt>
19  * @author <a HREF="mailto:bdecoste@jboss.com">William DeCoste</a>
20  */

21 public class SessionEnterpriseBean extends EnterpriseBean
22 {
23    private static final Logger log = Logger
24          .getLogger(SessionEnterpriseBean.class);
25
26    public static final String JavaDoc STATELESS = "Stateless";
27
28    public static final String JavaDoc STATEFUL = "Stateful";
29
30    public static final String JavaDoc BEAN = "Bean";
31
32    public static final String JavaDoc CONTAINER = "Container";
33
34    // ejb-jar.xml
35
private String JavaDoc sessionType = STATELESS;
36
37    private String JavaDoc transactionType = CONTAINER;
38
39    public boolean isStateless()
40    {
41       return sessionType.equals(STATELESS);
42    }
43
44    public boolean isStateful()
45    {
46       return sessionType.equals(STATEFUL);
47    }
48
49    public String JavaDoc getSessionType()
50    {
51       return sessionType;
52    }
53
54    public void setSessionType(String JavaDoc sessionType)
55    {
56       this.sessionType = sessionType;
57    }
58
59    public String JavaDoc getTransactionType()
60    {
61       return transactionType;
62    }
63
64    public void setTransactionType(String JavaDoc transactionType)
65    {
66       if (transactionType.equals(BEAN))
67          tmType = TransactionManagementType.BEAN;
68       else if (transactionType.equals(CONTAINER))
69          tmType = TransactionManagementType.CONTAINER;
70       this.transactionType = transactionType;
71    }
72
73    public String JavaDoc toString()
74    {
75       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(100);
76       sb.append('[');
77       sb.append(super.toString());
78       sb.append(",");
79       sb.append("sessionType=").append(sessionType);
80       sb.append(']');
81       return sb.toString();
82    }
83 }
84
Popular Tags