1 22 package org.jboss.ejb3.metamodel; 23 24 import java.util.List ; 25 import java.util.ArrayList ; 26 import org.jboss.logging.Logger; 27 28 import org.jboss.metamodel.descriptor.PersistenceUnitRef; 29 30 37 public class SessionEnterpriseBean extends EnterpriseBean 38 { 39 private static final Logger log = Logger 40 .getLogger(SessionEnterpriseBean.class); 41 42 public static final String STATELESS = "Stateless"; 43 44 public static final String STATEFUL = "Stateful"; 45 46 private String 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 <RemoveMethod> removeMethods = new ArrayList <RemoveMethod>(); 54 private List <InitMethod> initMethods = new ArrayList <InitMethod>(); 55 56 private String clustered = null; 57 private ClusterConfig clusterConfig = null; 58 private CacheConfig cacheConfig = null; 59 60 private String 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 getConcurrent() 73 { 74 return concurrent; 75 } 76 77 public void setConcurrent(String concurrent) 78 { 79 this.concurrent = concurrent; 80 } 81 82 public String getClustered() 83 { 84 return clustered; 85 } 86 87 public void setClustered(String 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 <RemoveMethod> getRemoveMethods() 103 { 104 return removeMethods; 105 } 106 107 public void addRemoveMethod(RemoveMethod method) 108 { 109 removeMethods.add(method); 110 } 111 112 public List <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 getSessionType() 133 { 134 return sessionType; 135 } 136 137 public void setSessionType(String 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 toString() 195 { 196 StringBuffer sb = new StringBuffer (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 |