KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > web > metamodel > descriptor > Servlet


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.web.metamodel.descriptor;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.Collection JavaDoc;
26 import java.util.HashMap JavaDoc;
27
28 import org.jboss.metamodel.descriptor.NameValuePair;
29 import org.jboss.metamodel.descriptor.RunAs;
30 import org.jboss.metamodel.descriptor.SecurityRoleRef;
31
32 import org.jboss.logging.Logger;
33
34 /**
35  * Represents a <servlet> element of the web.xml deployment descriptor for the
36  * 2.5 schema
37  *
38  * @author <a HREF="mailto:bdecoste@jboss.com">William DeCoste</a>
39  * @version <tt>$Revision: 45417 $</tt>
40  */

41 public class Servlet
42 {
43    private static final Logger log = Logger.getLogger(Servlet.class);
44    
45    protected String JavaDoc name;
46    protected String JavaDoc clazz;
47    protected String JavaDoc jspFile;
48    protected HashMap JavaDoc initParams = new HashMap JavaDoc();
49    protected String JavaDoc loadOnStartup;
50    protected RunAs runAs;
51    protected HashMap JavaDoc securityRoleRefs = new HashMap JavaDoc();
52    protected Collection JavaDoc runAsPrincipals = new ArrayList JavaDoc();
53    
54    public String JavaDoc getName()
55    {
56       return name;
57    }
58    
59    public void setName(String JavaDoc name)
60    {
61       this.name = name;
62    }
63    
64    public String JavaDoc getServletClass()
65    {
66       return clazz;
67    }
68    
69    public void setServletClass(String JavaDoc clazz)
70    {
71       this.clazz = clazz;
72    }
73    
74    public void setJspFile(String JavaDoc jspFile)
75    {
76       this.jspFile = jspFile;
77    }
78    
79    public String JavaDoc getJspFile()
80    {
81       return jspFile;
82    }
83    
84    public Collection JavaDoc getInitParams()
85    {
86       return initParams.values();
87    }
88    
89    public void addInitParam(NameValuePair param)
90    {
91       initParams.put(param.getName(), param);
92    }
93    
94    public String JavaDoc getLoadOnStartup()
95    {
96       return loadOnStartup;
97    }
98    
99    public void setLoadOnStartup(String JavaDoc loadOnStartup)
100    {
101       this.loadOnStartup = loadOnStartup;
102    }
103    
104    public RunAs getRunAs()
105    {
106       return runAs;
107    }
108    
109    public void setRunAs(RunAs runAs)
110    {
111       this.runAs = runAs;
112    }
113    
114    public Collection JavaDoc getSecurityRoleRefs()
115    {
116       return securityRoleRefs.values();
117    }
118    
119    public void addSecurityRoleRef(SecurityRoleRef ref)
120    {
121       securityRoleRefs.put(ref.getRoleName(), ref);
122    }
123    
124    public Collection JavaDoc getRunAsPrincipals()
125    {
126       return runAsPrincipals;
127    }
128    
129    public void setRunAsPrincipals(Collection JavaDoc runAsPrincipals)
130    {
131       this.runAsPrincipals = runAsPrincipals;
132    }
133    
134    public void addRunAsPrincipal(String JavaDoc principal)
135    {
136       runAsPrincipals.add(principal);
137    }
138    
139    public String JavaDoc toString()
140    {
141       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(100);
142       sb.append('[');
143       sb.append("name=" + name);
144       sb.append(", class=" + clazz);
145       sb.append(", jspFile=" + jspFile);
146       sb.append(']');
147       return sb.toString();
148    }
149 }
150
Popular Tags