1 22 package org.jboss.web.metamodel.descriptor; 23 24 import java.util.ArrayList ; 25 import java.util.Collection ; 26 import java.util.HashMap ; 27 import java.util.List ; 28 29 import org.jboss.logging.Logger; 30 import org.jboss.metamodel.descriptor.EnvironmentRefGroup; 31 import org.jboss.metamodel.descriptor.Listener; 32 import org.jboss.metamodel.descriptor.MessageDestination; 33 34 40 public class WebDD extends EnvironmentRefGroup 41 { 42 private static final Logger log = Logger.getLogger(WebDD.class); 43 44 protected String securityDomain; 45 protected HashMap filters = new HashMap (); 46 protected HashMap filterMappings = new HashMap (); 47 protected HashMap listeners = new HashMap (); 48 protected HashMap servlets = new HashMap (); 49 protected HashMap servletMappings = new HashMap (); 50 protected List sessionConfigs = new ArrayList (); 51 protected List securityConstraints = new ArrayList (); 52 protected HashMap securityRoles = new HashMap (); 53 protected LoginConfig loginConfig; 54 protected HashMap errorPages = new HashMap (); 55 protected HashMap messageDestinations = new HashMap (); 56 protected List dependencies = new ArrayList (); 57 protected ReplicationConfig replicationConfig; 58 59 public String getSecurityDomain() 60 { 61 return securityDomain; 62 } 63 64 public void setSecurityDomain(String securityDomain) 65 { 66 this.securityDomain = securityDomain; 67 } 68 69 public Collection getFilters() 70 { 71 return filters.values(); 72 } 73 74 public void addFilter(Filter filter) 75 { 76 filters.put(filter.getName(), filter); 77 } 78 79 public Collection getFilterMappings() 80 { 81 return filterMappings.values(); 82 } 83 84 public void addFilterMapping(FilterMapping mapping) 85 { 86 filterMappings.put(mapping.getFilterName(), mapping); 87 } 88 89 public Collection getListeners() 90 { 91 return listeners.values(); 92 } 93 94 public void addListener(Listener listener) 95 { 96 listeners.put(listener.getListenerClass(), listener); 97 } 98 99 public Collection getServlets() 100 { 101 return servlets.values(); 102 } 103 104 public void addServlet(Servlet servlet) 105 { 106 servlets.put(servlet.getName(), servlet); 107 } 108 109 public void updateServlet(Servlet updatedServlet) 110 { 111 Servlet servlet = (Servlet)servlets.get(updatedServlet.getName()); 112 if (servlet != null) 113 { 114 servlet.setRunAsPrincipals(updatedServlet.getRunAsPrincipals()); 115 } 116 else 117 { 118 servlets.put(updatedServlet.getName(), updatedServlet); 119 } 120 } 121 122 public Collection getServletMappings() 123 { 124 return servletMappings.values(); 125 } 126 127 public void addServletMapping(ServletMapping mapping) 128 { 129 servletMappings.put(mapping.getName(), mapping); 130 } 131 132 public Collection getSessionConfigs() 133 { 134 return sessionConfigs; 135 } 136 137 public void addSessionConfig(SessionConfig config) 138 { 139 sessionConfigs.add(config); 140 } 141 142 public Collection getSecurityRoles() 143 { 144 return securityRoles.values(); 145 } 146 147 public void addSecurityRole(SecurityRole securityRole) 148 { 149 securityRoles.put(securityRole.getRoleName(), securityRole); 150 } 151 152 public void updateSecurityRole(SecurityRole updatedRole) 153 { 154 SecurityRole role = (SecurityRole)securityRoles.get(updatedRole.getRoleName()); 155 if (role != null) 156 { 157 role.setPrincipalName(updatedRole.getPrincipalName()); 158 } 159 else 160 { 161 securityRoles.put(updatedRole.getRoleName(), updatedRole); 162 } 163 } 164 165 public Collection getSecurityConstraints() 166 { 167 return securityConstraints; 168 } 169 170 public void addSecurityConstraint(SecurityConstraint constraint) 171 { 172 securityConstraints.add(constraint); 173 } 174 175 public LoginConfig getLoginConfig() 176 { 177 return loginConfig; 178 } 179 180 public void setLoginConfig(LoginConfig loginConfig) 181 { 182 this.loginConfig = loginConfig; 183 } 184 185 public Collection getErrorPages() 186 { 187 return errorPages.values(); 188 } 189 190 public void addErrorPage(ErrorPage errorPage) 191 { 192 errorPages.put(errorPage.getErrorCode(), errorPage); 193 } 194 195 public Collection getMessageDestinations() 196 { 197 return messageDestinations.values(); 198 } 199 200 public void addMessageDestination(MessageDestination destination) 201 { 202 log.debug("addMessageDestination, "+destination); 203 messageDestinations.put(destination.getMessageDestinationName(), destination); 204 } 205 public void updateMessageDestination(MessageDestination updatedDestination) 206 { 207 MessageDestination destination = (MessageDestination) 208 messageDestinations.get(updatedDestination.getMessageDestinationName()); 209 if (destination != null) 210 { 211 destination.setMappedName(updatedDestination.getMappedName()); 212 } 213 else 214 { 215 messageDestinations.put(updatedDestination.getMessageDestinationName(), updatedDestination); 216 } 217 } 218 219 public void addDependency(String depends) 220 { 221 dependencies.add(depends); 222 } 223 224 public Collection getDependencies() 225 { 226 return dependencies; 227 } 228 229 public ReplicationConfig getReplicationConfig() 230 { 231 return replicationConfig; 232 } 233 234 public void setReplicationConfig(ReplicationConfig replicationConfig) 235 { 236 this.replicationConfig = replicationConfig; 237 } 238 239 public String toString() 240 { 241 StringBuffer sb = new StringBuffer (100); 242 sb.append('['); 243 sb.append(']'); 244 return sb.toString(); 245 } 246 } 247 | Popular Tags |