1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.ejb; 27 28 import java.util.ArrayList ; 29 import java.util.HashMap ; 30 31 import javax.servlet.http.HttpServletRequest ; 32 33 import org.apache.struts.action.ActionMessage; 34 import org.apache.struts.action.ActionErrors; 35 import org.apache.struts.action.ActionForm; 36 import org.apache.struts.action.ActionMapping; 37 38 41 public class EjbForm extends ActionForm { 42 43 45 48 private String type = null; 49 private String fullType = null; 50 private String file = null; 51 private String name = null; 52 private String objectName = null; 53 private String action = null; 54 55 58 private int currentInstancePoolSize = 0; 59 private String displayName = null; 60 private String ejbClass = null; 61 private String ejbFileName = null; 62 private String ejbName = null; 63 private String homeClass = null; 64 private String jndiName = null; 65 private String localClass = null; 66 private String localHomeClass = null; 67 private String remoteClass = null; 68 private boolean dependency = false; 69 private boolean databaseServiceActivated = false; 70 private boolean dataSource = false; 71 private HashMap dataSources = new HashMap (); 72 private boolean jmsServiceActivated = false; 73 private boolean joramResourceLoaded = false; 74 private boolean jmsConnection = false; 75 private ArrayList jmsConnections = new ArrayList (); 76 private boolean jmsDestination = false; 77 private ArrayList jmsDestinations = new ArrayList (); 78 private boolean mailServiceActivated = false; 79 private boolean mailSession = false; 80 private HashMap mailSessions = new HashMap (); 81 private boolean mailMime = false; 82 private HashMap mailMimes = new HashMap (); 83 84 86 92 93 public void reset(ActionMapping mapping, HttpServletRequest request) { 94 type = null; 96 file = null; 97 name = null; 98 objectName = null; 99 fullType = null; 100 action = null; 101 102 currentInstancePoolSize = 0; 104 displayName = null; 105 ejbClass = null; 106 ejbFileName = null; 107 ejbName = null; 108 homeClass = null; 109 jndiName = null; 110 localClass = null; 111 localHomeClass = null; 112 remoteClass = null; 113 114 dependency = false; 115 databaseServiceActivated = false; 116 dataSources = new HashMap (); 117 dataSource = false; 118 jmsServiceActivated = false; 119 joramResourceLoaded = false; 120 jmsConnection = false; 121 jmsConnections = new ArrayList (); 122 jmsDestination = false; 123 jmsDestinations = new ArrayList (); 124 mailServiceActivated = false; 125 mailSession = false; 126 mailSessions = new HashMap (); 127 mailMime = false; 128 mailMimes = new HashMap (); 129 } 130 131 142 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 143 ActionErrors oErrors = new ActionErrors(); 144 return oErrors; 145 } 146 147 149 151 public String getFile() { 152 return file; 153 } 154 155 public String getFilename() { 156 String sFilename = null; 157 if (file != null) { 158 sFilename = file.replace('\\', '/'); 159 int iPos = sFilename.lastIndexOf('/'); 160 if (iPos > -1) { 161 sFilename = sFilename.substring(iPos + 1); 162 } 163 } 164 return sFilename; 165 } 166 167 public String getName() { 168 return name; 169 } 170 171 public String getObjectName() { 172 return objectName; 173 } 174 175 public String getType() { 176 return type; 177 } 178 179 public void setFile(String file) { 180 this.file = file; 181 } 182 183 public void setName(String name) { 184 this.name = name; 185 } 186 187 public void setObjectName(String objectName) { 188 this.objectName = objectName; 189 } 190 191 public void setType(String type) { 192 this.type = type; 193 } 194 195 197 public int getCurrentInstancePoolSize() { 198 return currentInstancePoolSize; 199 } 200 201 public String getDisplayName() { 202 return displayName; 203 } 204 205 public String getEjbClass() { 206 return ejbClass; 207 } 208 209 public String getEjbName() { 210 return ejbName; 211 } 212 213 public String getHomeClass() { 214 return homeClass; 215 } 216 217 public String getJndiName() { 218 return jndiName; 219 } 220 221 public String getLocalClass() { 222 return localClass; 223 } 224 225 public String getLocalHomeClass() { 226 return localHomeClass; 227 } 228 229 public String getRemoteClass() { 230 return remoteClass; 231 } 232 233 public void setCurrentInstancePoolSize(int currentInstancePoolSize) { 234 this.currentInstancePoolSize = currentInstancePoolSize; 235 } 236 237 public void setDisplayName(String displayName) { 238 this.displayName = displayName; 239 } 240 241 public void setEjbClass(String ejbClass) { 242 this.ejbClass = ejbClass; 243 } 244 245 public void setEjbName(String ejbName) { 246 this.ejbName = ejbName; 247 } 248 249 public void setHomeClass(String homeClass) { 250 this.homeClass = homeClass; 251 } 252 253 public void setJndiName(String jndiName) { 254 this.jndiName = jndiName; 255 } 256 257 public void setLocalClass(String localClass) { 258 this.localClass = localClass; 259 } 260 261 public void setLocalHomeClass(String localHomeClass) { 262 this.localHomeClass = localHomeClass; 263 } 264 265 public void setRemoteClass(String remoteClass) { 266 this.remoteClass = remoteClass; 267 } 268 269 public String getEjbFileName() { 270 return ejbFileName; 271 } 272 273 public void setEjbFileName(String ejbFileName) { 274 this.ejbFileName = ejbFileName; 275 } 276 277 public String getFullType() { 278 return fullType; 279 } 280 281 public void setFullType(String fullType) { 282 this.fullType = fullType; 283 } 284 285 public HashMap getDataSources() { 286 return dataSources; 287 } 288 289 public void setDataSources(HashMap dataSources) { 290 this.dataSources = dataSources; 291 } 292 293 public boolean isDataSource() { 294 return dataSource; 295 } 296 297 public void setDataSource(boolean dataSource) { 298 this.dataSource = dataSource; 299 } 300 301 public boolean isDependency() { 302 return dependency; 303 } 304 305 public void setDependency(boolean dependency) { 306 this.dependency = dependency; 307 } 308 309 public boolean isJmsConnection() { 310 return jmsConnection; 311 } 312 313 public void setJmsConnection(boolean jmsConnection) { 314 this.jmsConnection = jmsConnection; 315 } 316 317 public ArrayList getJmsConnections() { 318 return jmsConnections; 319 } 320 321 public void setJmsConnections(ArrayList jmsConnections) { 322 this.jmsConnections = jmsConnections; 323 } 324 325 public boolean isJmsDestination() { 326 return jmsDestination; 327 } 328 329 public void setJmsDestination(boolean jmsDestination) { 330 this.jmsDestination = jmsDestination; 331 } 332 333 public ArrayList getJmsDestinations() { 334 return jmsDestinations; 335 } 336 337 public void setJmsDestinations(ArrayList jmsDestinations) { 338 this.jmsDestinations = jmsDestinations; 339 } 340 341 public HashMap getMailSessions() { 342 return mailSessions; 343 } 344 345 public void setMailSessions(HashMap mailSessions) { 346 this.mailSessions = mailSessions; 347 } 348 349 public HashMap getMailMimes() { 350 return mailMimes; 351 } 352 353 public void setMailMimes(HashMap mailMimes) { 354 this.mailMimes = mailMimes; 355 } 356 357 public boolean isMailSession() { 358 return mailSession; 359 } 360 361 public void setMailSession(boolean mailSession) { 362 this.mailSession = mailSession; 363 } 364 365 public boolean isMailMime() { 366 return mailMime; 367 } 368 369 public void setMailMime(boolean mailMime) { 370 this.mailMime = mailMime; 371 } 372 373 public boolean isDatabaseServiceActivated() { 374 return databaseServiceActivated; 375 } 376 377 public void setDatabaseServiceActivated(boolean databaseServiceActivated) { 378 this.databaseServiceActivated = databaseServiceActivated; 379 } 380 381 public boolean isJmsServiceActivated() { 382 return jmsServiceActivated; 383 } 384 385 public void setJmsServiceActivated(boolean jmsServiceActivated) { 386 this.jmsServiceActivated = jmsServiceActivated; 387 } 388 389 public boolean isMailServiceActivated() { 390 return mailServiceActivated; 391 } 392 393 public void setMailServiceActivated(boolean mailServiceActivated) { 394 this.mailServiceActivated = mailServiceActivated; 395 } 396 397 400 public boolean isJoramResourceLoaded() { 401 return joramResourceLoaded; 402 } 403 406 public void setJoramResourceLoaded(boolean joramResourceLoaded) { 407 this.joramResourceLoaded = joramResourceLoaded; 408 } 409 410 413 public String getAction() { 414 return action; 415 } 416 419 public void setAction(String action) { 420 this.action = action; 421 } 422 423 424 425 437 protected void numberCheck(ActionErrors p_Errors, String field, String numText, boolean rangeCheck 438 , int min, int max) { 439 if ((numText == null) || (numText.length() < 1)) { 441 p_Errors.add(field, new ActionMessage("error.ejb.type.session." + field + ".required")); 442 } else { 443 444 try { 446 int num = Integer.parseInt(numText); 447 if (rangeCheck) { 449 if ((num < min) || (num > max)) { 450 p_Errors.add(field 451 , new ActionMessage("error.ejb.type.session." + field + ".range")); 452 } 453 } 454 } catch (NumberFormatException e) { 455 p_Errors.add(field, new ActionMessage("error.ejb.type.session." + field + ".format")); 456 } 457 } 458 } 459 460 461 462 463 } 464 | Popular Tags |