1 25 26 package org.objectweb.jonas.webapp.jonasadmin.security; 27 28 import javax.servlet.http.HttpServletRequest ; 29 30 import org.apache.struts.action.ActionMessage; 31 import org.apache.struts.action.ActionErrors; 32 import org.apache.struts.action.ActionMapping; 33 34 37 public class MemoryRealmForm extends FactoryRealmForm { 38 39 41 43 private String [] groups = new String [0]; 44 private String [] roles = new String [0]; 45 46 48 54 55 public void reset(ActionMapping mapping, HttpServletRequest request) { 56 super.reset(mapping, request); 57 58 roles = new String [0]; 59 groups = new String [0]; 60 } 61 62 73 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 74 ActionErrors oErrors = new ActionErrors(); 75 if ((getName() == null) || (getName().length() == 0)) { 76 oErrors.add("name", new ActionMessage("error.security.factory.memory.realm.name.required")); 77 } 78 if ((getName() != null) && (getName().length() > 0)) { 79 if (getName().indexOf(' ') >= 0) { 80 oErrors.add("name" 81 , new ActionMessage("error.security.factory.memory.realm.name.nospace")); 82 } 83 } 84 return oErrors; 85 } 86 87 89 public String [] getGroups() { 90 return groups; 91 } 92 93 public void setGroups(String [] groups) { 94 this.groups = groups; 95 } 96 97 public String [] getRoles() { 98 return roles; 99 } 100 101 public void setRoles(String [] roles) { 102 this.roles = roles; 103 } 104 } | Popular Tags |