View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.pluto.descriptors.servlet;
17  
18  import java.util.ArrayList;
19  import java.util.Iterator;
20  import java.util.List;
21  
22  import org.apache.pluto.descriptors.common.IconDD;
23  
24  /***
25   * WebApplication configuration as contained
26   * within the web.xml Deployment Descriptor.
27   *
28   * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
29   * @version $Id: WebAppDD.java 158796 2005-03-23 16:28:41Z ddewolf $
30   * @since Feb 28, 2005
31   */
32  public class WebAppDD {
33  
34      private IconDD icon;
35      private String displayName;
36      private String description;
37      private boolean distributable;
38      private List contextParams = new ArrayList();
39      private List filters = new ArrayList();
40      private List filterMappings = new ArrayList();
41      private List listeners = new ArrayList();
42      private List servlets = new ArrayList();
43      private List servletMappings = new ArrayList();
44      private SessionConfigDD sessionConfig;
45      private List mimeMappings = new ArrayList();
46      private WelcomeFileListDD welcomeFileList;
47      private List errorPages = new ArrayList();
48      private List taglibs = new ArrayList();
49      private List resourceRefs = new ArrayList();
50      private List securityConstraints = new ArrayList();
51      private LoginConfigDD loginConfig;
52      private List securityRoles = new ArrayList();
53      private List envEntrys = new ArrayList();
54      private List ejbRefs = new ArrayList();
55  
56      public WebAppDD() {
57  
58      }
59  
60      public IconDD getIcon() {
61          return icon;
62      }
63  
64      public void setIcon(IconDD icon) {
65          this.icon= icon;
66      }
67  
68      public String getDisplayName() {
69          return displayName;
70      }
71  
72      public void setDisplayName(String displayName) {
73          this.displayName = displayName;
74      }
75  
76      public String getDescription() {
77          return description;
78      }
79  
80      public void setDescription(String description) {
81          this.description = description;
82      }
83  
84      public boolean isDistributable() {
85          return distributable;
86      }
87  
88      public void setDistributable() {
89          this.distributable = true;
90      }
91  
92      public void setDistributable(boolean distributable) {
93          this.distributable = distributable;
94      }
95  
96      /***
97       * Retrieve the context parameters.
98       * @return InitParamDD instances.
99       */
100     public List getContextParams() {
101         return contextParams;
102     }
103 
104     public void setContextParams(List contextParams) {
105         this.contextParams = contextParams;
106     }
107 
108     public List getFilters() {
109         return filters;
110     }
111 
112     public void setFilters(List filters) {
113         this.filters = filters;
114     }
115 
116     public List getFilterMappings() {
117         return filterMappings;
118     }
119 
120     public void setFilterMappings(List filterMappings) {
121         this.filterMappings = filterMappings;
122     }
123 
124     public List getListeners() {
125         return listeners;
126     }
127 
128     public void setListeners(List listeners) {
129         this.listeners = listeners;
130     }
131 
132     public List getServlets() {
133         return servlets;
134     }
135 
136     public void setServlets(List servlets) {
137         this.servlets = servlets;
138     }
139 
140     public List getServletMappings() {
141         return servletMappings;
142     }
143 
144     public void setServletMappings(List servletMappings) {
145         this.servletMappings = servletMappings;
146     }
147 
148     public SessionConfigDD getSessionConfig() {
149         return sessionConfig ;
150     }
151 
152     public void setSessionConfig(SessionConfigDD sessionConfig) {
153         this.sessionConfig = sessionConfig;
154     }
155 
156     public List getMimeMappings() {
157         return mimeMappings;
158     }
159 
160     public void setMimeMappings(List mimeMappings) {
161         this.mimeMappings = mimeMappings;
162     }
163 
164     public WelcomeFileListDD getWelcomeFileList() {
165         return welcomeFileList;
166     }
167 
168     public void setWelcomeFileList(WelcomeFileListDD welcomeFileList) {
169         this.welcomeFileList = welcomeFileList;
170     }
171 
172     public List getErrorPages() {
173         return errorPages;
174     }
175 
176     public void setErrorPages(List errorPages) {
177         this.errorPages = errorPages;
178     }
179 
180     public List getTaglibs() {
181         return taglibs;
182     }
183 
184     public void setTaglibs(List taglibs) {
185         this.taglibs = taglibs;
186     }
187 
188     public List getResourceRefs() {
189         return resourceRefs;
190     }
191 
192     public void setResourceRefs(List resourceRefs) {
193         this.resourceRefs = resourceRefs;
194     }
195 
196     public List getSecurityConstraints() {
197         return securityConstraints;
198     }
199 
200     public void setSecurityConstraints(List securityConstraints) {
201         this.securityConstraints = securityConstraints;
202     }
203 
204     public LoginConfigDD getLoginConfig() {
205         return loginConfig;
206     }
207 
208     public void setLoginConfig(LoginConfigDD loginConfig) {
209         this.loginConfig = loginConfig;
210     }
211 
212     public List getSecurityRoles() {
213         return securityRoles;
214     }
215 
216     public void setSecurityRoles(List securityRoles) {
217         this.securityRoles = securityRoles;
218     }
219 
220     public List getEnvEntrys() {
221         return envEntrys;
222     }
223 
224     public void setEnvEntrys(List envEntrys) {
225         this.envEntrys = envEntrys;
226     }
227 
228     public List getEjbRefs() {
229         return ejbRefs;
230     }
231 
232     public void setEjbRefs(List ejbRefs) {
233         this.ejbRefs = ejbRefs;
234     }
235 
236 // Helpers
237 
238     public ServletDD getServlet(String name) {
239         ArrayList set = new ArrayList(servlets);
240         Iterator it = set.iterator();
241         ServletDD dd;
242         while(name!=null && it.hasNext()) {
243             dd = (ServletDD)it.next();
244             if(name.equals(dd.getServletName())) {
245                 return dd;
246             }
247         }
248         return null;
249     }
250 
251     public ServletMappingDD getServletMapping(String uri) {
252         ArrayList set = new ArrayList(servletMappings);
253         Iterator it = set.iterator();
254         ServletMappingDD dd;
255         while(uri!=null && it.hasNext()) {
256             dd = (ServletMappingDD)it.next();
257             if(uri.equals(dd.getUrlPattern())) {
258                 return dd;
259             }
260         }
261         return null;
262     }
263 
264 
265     public FilterDD getFilter(String name) {
266         ArrayList list = new ArrayList(filters);
267         Iterator it = list.iterator();
268         FilterDD dd;
269         while(name!=null && it.hasNext()) {
270             dd = (FilterDD)it.next();
271             if(name.equals(dd.getFilterName())) {
272                 return dd;
273             }
274         }
275         return null;
276     }
277 }
278