KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.catalina;
19
20 import java.io.IOException JavaDoc;
21 import java.net.URL JavaDoc;
22 /**
23  * A <b>Cluster</b> works as a Cluster client/server for the local host
24  * Different Cluster implementations can be used to support different
25  * ways to communicate within the Cluster. A Cluster implementation is
26  * responsible for setting up a way to communicate within the Cluster
27  * and also supply "ClientApplications" with <code>ClusterSender</code>
28  * used when sending information in the Cluster and
29  * <code>ClusterInfo</code> used for receiving information in the Cluster.
30  *
31  * @author Bip Thelin
32  * @author Remy Maucherat
33  * @author Filip Hanik
34  * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
35  */

36
37 public interface Cluster {
38
39     // ------------------------------------------------------------- Properties
40

41     /**
42      * Return descriptive information about this Cluster implementation and
43      * the corresponding version number, in the format
44      * <code>&lt;description&gt;/&lt;version&gt;</code>.
45      */

46     public String JavaDoc getInfo();
47
48     /**
49      * Return the name of the cluster that this Server is currently
50      * configured to operate within.
51      *
52      * @return The name of the cluster associated with this server
53      */

54     public String JavaDoc getClusterName();
55
56     /**
57      * Set the name of the cluster to join, if no cluster with
58      * this name is present create one.
59      *
60      * @param clusterName The clustername to join
61      */

62     public void setClusterName(String JavaDoc clusterName);
63
64     /**
65      * Set the Container associated with our Cluster
66      *
67      * @param container The Container to use
68      */

69     public void setContainer(Container container);
70
71     /**
72      * Get the Container associated with our Cluster
73      *
74      * @return The Container associated with our Cluster
75      */

76     public Container getContainer();
77
78     /**
79      * Set the protocol parameters.
80      *
81      * @param protocol The protocol used by the cluster
82      * @deprecated
83      */

84     public void setProtocol(String JavaDoc protocol);
85
86     /**
87      * Get the protocol used by the cluster.
88      *
89      * @return The protocol
90      * @deprecated
91      */

92     public String JavaDoc getProtocol();
93
94     // --------------------------------------------------------- Public Methods
95

96     /**
97      * Create a new manager which will use this cluster to replicate its
98      * sessions.
99      *
100      * @param name Name (key) of the application with which the manager is
101      * associated
102      */

103     public Manager createManager(String JavaDoc name);
104     
105     /**
106      * Register a manager with the cluster. If the cluster is not responsible
107      * for creating a manager, then the container will at least notify the
108      * cluster that this mananger is participating in the cluster.
109      * @param manager Manager
110      */

111     public void registerManager(Manager manager);
112     
113     /**
114      * Removes a manager from the cluster
115      * @param manager Manager
116      */

117     public void removeManager(Manager manager);
118
119     // --------------------------------------------------------- Cluster Wide Deployments
120

121     
122     /**
123      * Execute a periodic task, such as reloading, etc. This method will be
124      * invoked inside the classloading context of this container. Unexpected
125      * throwables will be caught and logged.
126      */

127     public void backgroundProcess();
128
129
130     /**
131      * Start an existing web application, attached to the specified context
132      * path in all the other nodes in the cluster.
133      * Only starts a web application if it is not running.
134      *
135      * @param contextPath The context path of the application to be started
136      *
137      * @exception IllegalArgumentException if the specified context path
138      * is malformed (it must be "" or start with a slash)
139      * @exception IllegalArgumentException if the specified context path does
140      * not identify a currently installed web application
141      * @exception IOException if an input/output error occurs during
142      * startup
143      * @deprecated
144      */

145     public void startContext(String JavaDoc contextPath) throws IOException JavaDoc;
146
147
148     /**
149      * Install a new web application, whose web application archive is at the
150      * specified URL, into this container with the specified context path.
151      * A context path of "" (the empty string) should be used for the root
152      * application for this container. Otherwise, the context path must
153      * start with a slash.
154      * <p>
155      * If this application is successfully installed, a ContainerEvent of type
156      * <code>PRE_INSTALL_EVENT</code> will be sent to registered listeners
157      * before the associated Context is started, and a ContainerEvent of type
158      * <code>INSTALL_EVENT</code> will be sent to all registered listeners
159      * after the associated Context is started, with the newly created
160      * <code>Context</code> as an argument.
161      *
162      * @param contextPath The context path to which this application should
163      * be installed (must be unique)
164      * @param war A URL of type "jar:" that points to a WAR file, or type
165      * "file:" that points to an unpacked directory structure containing
166      * the web application to be installed
167      *
168      * @exception IllegalArgumentException if the specified context path
169      * is malformed (it must be "" or start with a slash)
170      * @exception IllegalStateException if the specified context path
171      * is already attached to an existing web application
172      * @deprecated
173      */

174     public void installContext(String JavaDoc contextPath, URL JavaDoc war);
175
176     /**
177      * Stop an existing web application, attached to the specified context
178      * path. Only stops a web application if it is running.
179      *
180      * @param contextPath The context path of the application to be stopped
181      *
182      * @exception IllegalArgumentException if the specified context path
183      * is malformed (it must be "" or start with a slash)
184      * @exception IllegalArgumentException if the specified context path does
185      * not identify a currently installed web application
186      * @exception IOException if an input/output error occurs while stopping
187      * the web application
188      * @deprecated
189      */

190     public void stop(String JavaDoc contextPath) throws IOException JavaDoc;
191
192
193 }
194
Popular Tags