KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.ejb3.metamodel;
23
24 import java.util.List JavaDoc;
25 import java.util.ArrayList JavaDoc;
26 import org.jboss.logging.Logger;
27
28 import org.jboss.metamodel.descriptor.PersistenceUnitRef;
29
30 /**
31  * Represents a Session EJB element of the ejb-jar.xml deployment descriptor for
32  * the 1.4 schema
33  *
34  * @author <a HREF="mailto:bdecoste@jboss.com">William DeCoste</a>
35  * @version <tt>$Revision: 45712 $</tt>
36  */

37 public class SessionEnterpriseBean extends EnterpriseBean
38 {
39    private static final Logger log = Logger
40            .getLogger(SessionEnterpriseBean.class);
41
42    public static final String JavaDoc STATELESS = "Stateless";
43
44    public static final String JavaDoc STATEFUL = "Stateful";
45
46    // ejb-jar.xml
47
private String JavaDoc sessionType = STATELESS;
48    private Method aroundInvoke;
49    private Method postConstruct;
50    private Method postActivate;
51    private Method preDestroy;
52    private Method prePassivate;
53    private List JavaDoc<RemoveMethod> removeMethods = new ArrayList JavaDoc<RemoveMethod>();
54    private List JavaDoc<InitMethod> initMethods = new ArrayList JavaDoc<InitMethod>();
55    
56    private String JavaDoc clustered = null;
57    private ClusterConfig clusterConfig = null;
58    private CacheConfig cacheConfig = null;
59    
60    private String JavaDoc concurrent = null;
61    
62    public CacheConfig getCacheConfig()
63    {
64       return cacheConfig;
65    }
66    
67    public void setCacheConfig(CacheConfig cacheConfig)
68    {
69       this.cacheConfig = cacheConfig;
70    }
71    
72    public String JavaDoc getConcurrent()
73    {
74       return concurrent;
75    }
76    
77    public void setConcurrent(String JavaDoc concurrent)
78    {
79       this.concurrent = concurrent;
80    }
81    
82    public String JavaDoc getClustered()
83    {
84       return clustered;
85    }
86    
87    public void setClustered(String JavaDoc clustered)
88    {
89       this.clustered = clustered;
90    }
91    
92    public ClusterConfig getClusterConfig()
93    {
94       return clusterConfig;
95    }
96    
97    public void setClusterConfig(ClusterConfig clusterConfig)
98    {
99       this.clusterConfig = clusterConfig;
100    }
101
102    public List JavaDoc<RemoveMethod> getRemoveMethods()
103    {
104       return removeMethods;
105    }
106    
107    public void addRemoveMethod(RemoveMethod method)
108    {
109       removeMethods.add(method);
110    }
111    
112    public List JavaDoc<InitMethod> getInitMethods()
113    {
114       return initMethods;
115    }
116    
117    public void addInitMethod(InitMethod method)
118    {
119       initMethods.add(method);
120    }
121
122    public boolean isStateless()
123    {
124       return sessionType.equals(STATELESS);
125    }
126
127    public boolean isStateful()
128    {
129       return sessionType.equals(STATEFUL);
130    }
131
132    public String JavaDoc getSessionType()
133    {
134       return sessionType;
135    }
136
137    public void setSessionType(String JavaDoc sessionType)
138    {
139       this.sessionType = sessionType;
140    }
141
142    public Method getAroundInvoke()
143    {
144       return aroundInvoke;
145    }
146
147    public void setAroundInvoke(Method aroundInvoke)
148    {
149       this.aroundInvoke = aroundInvoke;
150    }
151
152    public Method getPostActivate()
153    {
154       if (sessionType.equals(STATELESS)) return null;
155       return postActivate;
156    }
157
158    public void setPostActivate(Method postActivate)
159    {
160       this.postActivate = postActivate;
161    }
162
163    public Method getPostConstruct()
164    {
165       return postConstruct;
166    }
167
168    public void setPostConstruct(Method postConstruct)
169    {
170       this.postConstruct = postConstruct;
171    }
172
173    public Method getPreDestroy()
174    {
175       return preDestroy;
176    }
177
178    public void setPreDestroy(Method preDestroy)
179    {
180       this.preDestroy = preDestroy;
181    }
182
183    public Method getPrePassivate()
184    {
185       if (sessionType.equals(STATELESS)) return null;
186       return prePassivate;
187    }
188
189    public void setPrePassivate(Method prePassivate)
190    {
191       this.prePassivate = prePassivate;
192    }
193    
194    public String JavaDoc toString()
195    {
196       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(100);
197       sb.append('[');
198       sb.append(super.toString());
199       sb.append(",");
200       sb.append("sessionType=").append(sessionType);
201       sb.append(']');
202       return sb.toString();
203    }
204 }
205
Popular Tags