KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > data > webapps > JahiaWebAppsPackage


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//
13
//
14
// JahiaWebAppsPackage
15
//
16
// NK 16.01.2001
17
//
18
//
19

20 package org.jahia.data.webapps;
21
22 import java.util.Vector JavaDoc;
23
24 /**
25  * Holds Informations about a webapps package ( a war , ear or even an unziped directory
26  *
27  *
28  * @author Khue ng
29  * @version 1.0
30  */

31 public class JahiaWebAppsPackage {
32
33     /**
34      * A list of JahiaWebAppDef Object
35      * @associates JahiaWebAppDef
36      */

37     private Vector JavaDoc m_WebApps = new Vector JavaDoc();
38
39     /**
40      * The ContextRoot for all the web apps within the package
41      * in case of ear file, it's the application context
42      **/

43     private String JavaDoc m_ContextRoot ;
44
45     /** the file or directory name from which data are loaded **/
46     private String JavaDoc m_FileName;
47
48     /** the full path to the source file or directory **/
49     private String JavaDoc m_FilePath;
50
51     /** the package type **/
52     private int m_Type ; // 1=war, 2=ear, 3=directory
53

54     /** war package **/
55     private static final int WAR = 1;
56
57     /** ear package **/
58     private static final int EAR = 2;
59
60     /** directory **/
61     public static final int DIR = 3;
62
63     /** has EJB or not ? **/
64     private boolean m_HasEJB = false;
65
66
67    /**
68     * Constructor
69     *
70     * @param (String) contextRoot , the context root of the web apps
71     */

72     public JahiaWebAppsPackage ( String JavaDoc contextRoot ) {
73        m_ContextRoot = contextRoot;
74     }
75
76    /**
77     * Get the WebApps List
78     *
79     * @return (Vector) the Vector of webapps list
80     */

81    public Vector JavaDoc getWebApps(){
82
83       return m_WebApps;
84
85    }
86
87    /**
88     * Set the WebApps List
89     *
90     * @param (Vector) the Vector of webapps list
91     */

92    public void addWebAppDef(Vector JavaDoc vec){
93
94       m_WebApps.addAll(vec);
95
96    }
97
98
99    /**
100     * Add a WebApps Definition in the Web Apps list
101     *
102     * @param (JahiaWebAppDef) webAppDef
103     */

104    public void addWebAppDef(JahiaWebAppDef webAppDef ){
105
106       m_WebApps.add(webAppDef);
107
108    }
109
110
111    /**
112     * Returns the Context Root of this package
113     *
114     * @return (String) the context root
115     */

116    public String JavaDoc getContextRoot(){
117
118       return m_ContextRoot;
119
120    }
121
122
123     /**
124      * get the source filename
125      *
126      */

127     public String JavaDoc getFileName(){
128         return this.m_FileName;
129     }
130
131
132     /**
133      * set the source filename
134      *
135      */

136     public void setFileName(String JavaDoc name){
137         this.m_FileName = name;
138
139         if ( name.endsWith(".war") ){
140             m_Type = WAR;
141         } else if ( name.endsWith(".ear") ){
142             m_Type = EAR;
143         } else {
144             m_Type = DIR;
145         }
146     }
147
148
149     /**
150      * get the file path
151      *
152      */

153     public String JavaDoc getFilePath(){
154         return this.m_FilePath;
155     }
156
157     /**
158      * set the file path
159      *
160      */

161     public void setFilePath(String JavaDoc path){
162         this.m_FilePath = path;
163     }
164
165
166
167     /**
168      * if the source is a war file
169      *
170      */

171     public boolean isWarFile(){
172         return (m_Type == WAR);
173     }
174
175
176     /**
177      * if the source is an ear file
178      *
179      */

180     public boolean isEarFile(){
181         return ( m_Type == EAR );
182     }
183
184
185     /**
186      * if the source is a directory
187      *
188      */

189     public boolean isDirectory(){
190         return ( m_Type == DIR );
191     }
192
193
194     /**
195      * set has EJB or not
196      */

197     public void setHasEJB(boolean val){
198         m_HasEJB = val;
199     }
200
201
202     /**
203      * uses EJB or not ?
204      * @return boolean has EJB or not
205      */

206     public boolean hasEJB(){
207         return m_HasEJB;
208     }
209
210     public void setType(int m_Type) {
211         this.m_Type = m_Type;
212     }
213 } // end JahiaWebAppsPackage
214
Popular Tags