001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.ejb3.metamodel;
023:
024: import java.util.List;
025: import java.util.ArrayList;
026: import org.jboss.logging.Logger;
027:
028: import org.jboss.metamodel.descriptor.PersistenceUnitRef;
029:
030: /**
031: * Represents a Session EJB element of the ejb-jar.xml deployment descriptor for
032: * the 1.4 schema
033: *
034: * @author <a href="mailto:bdecoste@jboss.com">William DeCoste</a>
035: * @version <tt>$Revision: 60233 $</tt>
036: */
037: public class SessionEnterpriseBean extends EnterpriseBean {
038: private static final Logger log = Logger
039: .getLogger(SessionEnterpriseBean.class);
040:
041: public static final String STATELESS = "Stateless";
042:
043: public static final String STATEFUL = "Stateful";
044:
045: // ejb-jar.xml
046: private String sessionType = STATELESS;
047: private Method aroundInvoke;
048: private Method postConstruct;
049: private Method postActivate;
050: private Method preDestroy;
051: private Method prePassivate;
052: private List<RemoveMethod> removeMethods = new ArrayList<RemoveMethod>();
053: private List<InitMethod> initMethods = new ArrayList<InitMethod>();
054:
055: private String clustered = null;
056: private ClusterConfig clusterConfig = null;
057: private CacheConfig cacheConfig = null;
058:
059: private String concurrent = null;
060:
061: public CacheConfig getCacheConfig() {
062: return cacheConfig;
063: }
064:
065: public void setCacheConfig(CacheConfig cacheConfig) {
066: this .cacheConfig = cacheConfig;
067: }
068:
069: public String getConcurrent() {
070: return concurrent;
071: }
072:
073: public void setConcurrent(String concurrent) {
074: this .concurrent = concurrent;
075: }
076:
077: public String getClustered() {
078: return clustered;
079: }
080:
081: public void setClustered(String clustered) {
082: this .clustered = clustered;
083: }
084:
085: public ClusterConfig getClusterConfig() {
086: return clusterConfig;
087: }
088:
089: public void setClusterConfig(ClusterConfig clusterConfig) {
090: this .clusterConfig = clusterConfig;
091: }
092:
093: public List<RemoveMethod> getRemoveMethods() {
094: return removeMethods;
095: }
096:
097: public void addRemoveMethod(RemoveMethod method) {
098: removeMethods.add(method);
099: }
100:
101: public List<InitMethod> getInitMethods() {
102: return initMethods;
103: }
104:
105: public void addInitMethod(InitMethod method) {
106: initMethods.add(method);
107: }
108:
109: public boolean isStateless() {
110: return sessionType.equals(STATELESS);
111: }
112:
113: public boolean isStateful() {
114: return sessionType.equals(STATEFUL);
115: }
116:
117: public String getSessionType() {
118: return sessionType;
119: }
120:
121: public void setSessionType(String sessionType) {
122: this .sessionType = sessionType;
123: }
124:
125: public Method getAroundInvoke() {
126: return aroundInvoke;
127: }
128:
129: public void setAroundInvoke(Method aroundInvoke) {
130: this .aroundInvoke = aroundInvoke;
131: }
132:
133: public Method getPostActivate() {
134: if (sessionType.equals(STATELESS))
135: return null;
136: return postActivate;
137: }
138:
139: public void setPostActivate(Method postActivate) {
140: this .postActivate = postActivate;
141: }
142:
143: public Method getPostConstruct() {
144: return postConstruct;
145: }
146:
147: public void setPostConstruct(Method postConstruct) {
148: this .postConstruct = postConstruct;
149: }
150:
151: public Method getPreDestroy() {
152: return preDestroy;
153: }
154:
155: public void setPreDestroy(Method preDestroy) {
156: this .preDestroy = preDestroy;
157: }
158:
159: public Method getPrePassivate() {
160: if (sessionType.equals(STATELESS))
161: return null;
162: return prePassivate;
163: }
164:
165: public void setPrePassivate(Method prePassivate) {
166: this .prePassivate = prePassivate;
167: }
168:
169: public String toString() {
170: StringBuffer sb = new StringBuffer(100);
171: sb.append('[');
172: sb.append(super .toString());
173: sb.append(",");
174: sb.append("sessionType=").append(sessionType);
175: sb.append(']');
176: return sb.toString();
177: }
178: }
|