KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > data > applications > ServletBean


1
2 package org.jahia.data.applications;
3
4 import java.io.Serializable JavaDoc;
5
6
7 /**
8  * This object contains all the data relative to a servlet, notably the
9  * context in which it should run, it's type (servlet or JSP) and additionnal
10  * @author Serge Huber
11  * @version 1.0
12  */

13 public class ServletBean implements Serializable JavaDoc {
14
15     public final static int SERVLET_TYPE = 1;
16     public final static int JSP_TYPE = 2;
17     public final static String JavaDoc SERVLET = "SERVLET";
18     public final static String JavaDoc JSP = "JSP";
19     private boolean isWelcomeFile = false;
20
21     private String JavaDoc name; // display name
22
private String JavaDoc context; // the servlet context
23
private String JavaDoc servletName; // Servlet alias ex: HelloWorldServlet
24
private String JavaDoc servletsrc; // Servlet classe or jsp file ex: /jsp/HelloWorld.jsp ou org.jahia.HelloWorldServlet
25
private int webAppType = SERVLET_TYPE; // 1=servlet, 2=jsp
26
private String JavaDoc desc; // desc
27
private String JavaDoc urlMappingPattern = "" ; // the mapping pattern that matched this servlet
28

29     /** if loaded in the Aplication registry or not
30      that is instantiated
31      **/

32     private boolean loaded = false;
33
34
35     /**
36      *
37      */

38     public ServletBean(
39                             int webAppType,
40                             String JavaDoc name,
41                             String JavaDoc servletName,
42                             String JavaDoc servletsrc,
43                             String JavaDoc context,
44                             String JavaDoc desc
45                       )
46                       {
47         this.webAppType = webAppType;
48         this.name = name;
49         this.context = context;
50         this.servletName = servletName;
51         this.servletsrc = servletsrc;
52         this.desc = desc;
53
54         if ( this.name == null ){
55             this.name = "";
56         }
57
58         if ( this.context == null ){
59             this.context = "";
60         }
61
62         if ( this.servletName == null ){
63             this.servletName = "";
64         }
65
66         if ( this.servletsrc == null ){
67             this.servletsrc = "";
68         }
69
70     } // end constructor
71

72
73
74     /**
75      * accessor methods
76      * {
77      */

78     public String JavaDoc getName() { return name; }
79     public String JavaDoc getContext() { return context; }
80     public String JavaDoc getServletName() { return servletName; }
81     public String JavaDoc getservletsrc() { return servletsrc; }
82     public int getWebAppType() { return webAppType; }
83     public String JavaDoc getdesc() { return desc; }
84     public String JavaDoc getUrlMappingPattern() { return urlMappingPattern; }
85     public boolean isLoaded() { return loaded; }
86     public boolean isWelcomeFile() { return isWelcomeFile; }
87
88
89     public String JavaDoc getWebAppTypeLabel(){
90
91         if ( webAppType == SERVLET_TYPE ){
92             return SERVLET;
93         }
94         return JSP;
95     }
96
97
98     public void setName( String JavaDoc name ) { this.name = name; }
99     public void setContext( String JavaDoc context ) { this.context = context; }
100     public void setServletName( String JavaDoc servletName ) { this.servletName = servletName; }
101     public void setservletsrc( String JavaDoc servletsrc ) { this.servletsrc = servletsrc; }
102     public void setWebAppType( int webAppType ) { this.webAppType = webAppType; }
103     public void setUrlMappingPattern( String JavaDoc pattern ) { this.urlMappingPattern = pattern; }
104     public void setdesc( String JavaDoc desc ) { this.desc = desc; }
105     public void setLoaded( boolean loaded ) { this.loaded = loaded; }
106     public void setIsWelcomeFile( boolean isWelcomeFile ) { this.isWelcomeFile = isWelcomeFile; }
107
108
109     // end accessor methods
110

111
112 } // end ServletBean
113
Popular Tags