KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > Deployer


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.catalina;
30
31
32 import java.io.IOException JavaDoc;
33 import java.net.URL JavaDoc;
34
35
36 /**
37  * A <b>Deployer</b> is a specialized Container into which web applications
38  * can be deployed and undeployed. Such a Container will create and install
39  * child Context instances for each deployed application. The unique key
40  * for each web application will be the context path to which it is attached.
41  *
42  * @author Craig R. McClanahan
43  * @version $Revision: 1.2 $ $Date: 2005/12/08 01:27:15 $
44  */

45
46 /* public interface Deployer extends Container { */
47 public interface Deployer {
48
49
50     // ----------------------------------------------------- Manifest Constants
51

52
53     /**
54      * The ContainerEvent event type sent when a new application is
55      * being installed by <code>install()</code>, before it has been
56      * started.
57      */

58     public static final String JavaDoc PRE_INSTALL_EVENT = "pre-install";
59
60
61     /**
62      * The ContainerEvent event type sent when a new application is
63      * installed by <code>install()</code>, after it has been started.
64      */

65     public static final String JavaDoc INSTALL_EVENT = "install";
66
67
68     /**
69      * The ContainerEvent event type sent when an existing application is
70      * removed by <code>remove()</code>.
71      */

72     public static final String JavaDoc REMOVE_EVENT = "remove";
73
74
75     // --------------------------------------------------------- Public Methods
76

77
78     /**
79      * Return the name of the Container with which this Deployer is associated.
80      */

81     public String JavaDoc getName();
82
83
84     /**
85      * Install a new web application, whose web application archive is at the
86      * specified URL, into this container with the specified context path.
87      * A context path of "" (the empty string) should be used for the root
88      * application for this container. Otherwise, the context path must
89      * start with a slash.
90      * <p>
91      * If this application is successfully installed, a ContainerEvent of type
92      * <code>INSTALL_EVENT</code> will be sent to all registered listeners,
93      * with the newly created <code>Context</code> as an argument.
94      *
95      * @param contextPath The context path to which this application should
96      * be installed (must be unique)
97      * @param war A URL of type "jar:" that points to a WAR file, or type
98      * "file:" that points to an unpacked directory structure containing
99      * the web application to be installed
100      *
101      * @exception IllegalArgumentException if the specified context path
102      * is malformed (it must be "" or start with a slash)
103      * @exception IllegalStateException if the specified context path
104      * is already attached to an existing web application
105      * @exception IOException if an input/output error was encountered
106      * during installation
107      */

108     public void install(String JavaDoc contextPath, URL JavaDoc war) throws IOException JavaDoc;
109
110
111     /**
112      * <p>Install a new web application, whose context configuration file
113      * (consisting of a <code>&lt;Context&gt;</code> element) and web
114      * application archive are at the specified URLs.</p>
115      *
116      * <p>If this application is successfully installed, a ContainerEvent
117      * of type <code>INSTALL_EVENT</code> will be sent to all registered
118      * listeners, with the newly created <code>Context</code> as an argument.
119      * </p>
120      *
121      * @param config A URL that points to the context configuration file to
122      * be used for configuring the new Context
123      * @param war A URL of type "jar:" that points to a WAR file, or type
124      * "file:" that points to an unpacked directory structure containing
125      * the web application to be installed
126      *
127      * @exception IllegalArgumentException if one of the specified URLs is
128      * null
129      * @exception IllegalStateException if the context path specified in the
130      * context configuration file is already attached to an existing web
131      * application
132      * @exception IOException if an input/output error was encountered
133      * during installation
134      */

135     public void install(URL JavaDoc config, URL JavaDoc war) throws IOException JavaDoc;
136
137
138     /**
139      * Return the Context for the deployed application that is associated
140      * with the specified context path (if any); otherwise return
141      * <code>null</code>.
142      *
143      * @param contextPath The context path of the requested web application
144      */

145     public Context findDeployedApp(String JavaDoc contextPath);
146
147
148     /**
149      * Return the context paths of all deployed web applications in this
150      * Container. If there are no deployed applications, a zero-length
151      * array is returned.
152      */

153     public String JavaDoc[] findDeployedApps();
154
155
156     /**
157      * Remove an existing web application, attached to the specified context
158      * path. If this application is successfully removed, a
159      * ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all
160      * registered listeners, with the removed <code>Context</code> as
161      * an argument.
162      *
163      * @param contextPath The context path of the application to be removed
164      *
165      * @exception IllegalArgumentException if the specified context path
166      * is malformed (it must be "" or start with a slash)
167      * @exception IllegalArgumentException if the specified context path does
168      * not identify a currently installed web application
169      * @exception IOException if an input/output error occurs during
170      * removal
171      */

172     public void remove(String JavaDoc contextPath) throws IOException JavaDoc;
173
174
175     /**
176      * Remove an existing web application, attached to the specified context
177      * path. If this application is successfully removed, a
178      * ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all
179      * registered listeners, with the removed <code>Context</code> as
180      * an argument. Deletes the web application war file and/or directory
181      * if they exist in the Host's appBase.
182      *
183      * @param contextPath The context path of the application to be removed
184      * @param undeploy boolean flag to remove web application from server
185      *
186      * @exception IllegalArgumentException if the specified context path
187      * is malformed (it must be "" or start with a slash)
188      * @exception IllegalArgumentException if the specified context path does
189      * not identify a currently installed web application
190      * @exception IOException if an input/output error occurs during
191      * removal
192      */

193     public void remove(String JavaDoc contextPath, boolean undeploy) throws IOException JavaDoc;
194
195
196     /**
197      * Start an existing web application, attached to the specified context
198      * path. Only starts a web application if it is not running.
199      *
200      * @param contextPath The context path of the application to be started
201      *
202      * @exception IllegalArgumentException if the specified context path
203      * is malformed (it must be "" or start with a slash)
204      * @exception IllegalArgumentException if the specified context path does
205      * not identify a currently installed web application
206      * @exception IOException if an input/output error occurs during
207      * startup
208      */

209     public void start(String JavaDoc contextPath) throws IOException JavaDoc;
210
211
212     /**
213      * Stop an existing web application, attached to the specified context
214      * path. Only stops a web application if it is running.
215      *
216      * @param contextPath The context path of the application to be stopped
217      *
218      * @exception IllegalArgumentException if the specified context path
219      * is malformed (it must be "" or start with a slash)
220      * @exception IllegalArgumentException if the specified context path does
221      * not identify a currently installed web application
222      * @exception IOException if an input/output error occurs while stopping
223      * the web application
224      */

225     public void stop(String JavaDoc contextPath) throws IOException JavaDoc;
226
227
228 }
229
Popular Tags