001: /*
002: * Copyright 1999,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina;
018:
019: import java.io.IOException;
020: import java.net.URL;
021:
022: /**
023: * A <b>Cluster</b> works as a Cluster client/server for the local host
024: * Different Cluster implementations can be used to support different
025: * ways to communicate within the Cluster. A Cluster implementation is
026: * responsible for setting up a way to communicate within the Cluster
027: * and also supply "ClientApplications" with <code>ClusterSender</code>
028: * used when sending information in the Cluster and
029: * <code>ClusterInfo</code> used for receiving information in the Cluster.
030: *
031: * @author Bip Thelin
032: * @author Remy Maucherat
033: * @author Filip Hanik
034: * @version $Revision: 1.7 $, $Date: 2004/05/26 15:24:59 $
035: */
036:
037: public interface Cluster {
038:
039: // ------------------------------------------------------------- Properties
040:
041: /**
042: * Return descriptive information about this Cluster implementation and
043: * the corresponding version number, in the format
044: * <code><description>/<version></code>.
045: */
046: public String getInfo();
047:
048: /**
049: * Return the name of the cluster that this Server is currently
050: * configured to operate within.
051: *
052: * @return The name of the cluster associated with this server
053: */
054: public String getClusterName();
055:
056: /**
057: * Set the name of the cluster to join, if no cluster with
058: * this name is present create one.
059: *
060: * @param clusterName The clustername to join
061: */
062: public void setClusterName(String clusterName);
063:
064: /**
065: * Set the Container associated with our Cluster
066: *
067: * @param container The Container to use
068: */
069: public void setContainer(Container container);
070:
071: /**
072: * Get the Container associated with our Cluster
073: *
074: * @return The Container associated with our Cluster
075: */
076: public Container getContainer();
077:
078: /**
079: * The debug detail level for this Cluster
080: *
081: * @param debug The debug level
082: */
083: public void setDebug(int debug);
084:
085: /**
086: * Returns the debug level for this Cluster
087: *
088: * @return The debug level
089: */
090: public int getDebug();
091:
092: /**
093: * Set the protocol parameters.
094: *
095: * @param protocol The protocol used by the cluster
096: */
097: public void setProtocol(String protocol);
098:
099: /**
100: * Get the protocol used by the cluster.
101: *
102: * @return The protocol
103: */
104: public String getProtocol();
105:
106: // --------------------------------------------------------- Public Methods
107:
108: /**
109: * Create a new manager which will use this cluster to replicate its
110: * sessions.
111: *
112: * @param name Name (key) of the application with which the manager is
113: * associated
114: */
115: public Manager createManager(String name);
116:
117: // --------------------------------------------------------- Cluster Wide Deployments
118: /**
119: * Start an existing web application, attached to the specified context
120: * path in all the other nodes in the cluster.
121: * Only starts a web application if it is not running.
122: *
123: * @param contextPath The context path of the application to be started
124: *
125: * @exception IllegalArgumentException if the specified context path
126: * is malformed (it must be "" or start with a slash)
127: * @exception IllegalArgumentException if the specified context path does
128: * not identify a currently installed web application
129: * @exception IOException if an input/output error occurs during
130: * startup
131: */
132: public void startContext(String contextPath) throws IOException;
133:
134: /**
135: * Install a new web application, whose web application archive is at the
136: * specified URL, into this container with the specified context path.
137: * A context path of "" (the empty string) should be used for the root
138: * application for this container. Otherwise, the context path must
139: * start with a slash.
140: * <p>
141: * If this application is successfully installed, a ContainerEvent of type
142: * <code>PRE_INSTALL_EVENT</code> will be sent to registered listeners
143: * before the associated Context is started, and a ContainerEvent of type
144: * <code>INSTALL_EVENT</code> will be sent to all registered listeners
145: * after the associated Context is started, with the newly created
146: * <code>Context</code> as an argument.
147: *
148: * @param contextPath The context path to which this application should
149: * be installed (must be unique)
150: * @param war A URL of type "jar:" that points to a WAR file, or type
151: * "file:" that points to an unpacked directory structure containing
152: * the web application to be installed
153: *
154: * @exception IllegalArgumentException if the specified context path
155: * is malformed (it must be "" or start with a slash)
156: * @exception IllegalStateException if the specified context path
157: * is already attached to an existing web application
158: */
159: public void installContext(String contextPath, URL war);
160:
161: /**
162: * Stop an existing web application, attached to the specified context
163: * path. Only stops a web application if it is running.
164: *
165: * @param contextPath The context path of the application to be stopped
166: *
167: * @exception IllegalArgumentException if the specified context path
168: * is malformed (it must be "" or start with a slash)
169: * @exception IllegalArgumentException if the specified context path does
170: * not identify a currently installed web application
171: * @exception IOException if an input/output error occurs while stopping
172: * the web application
173: */
174: public void stop(String contextPath) throws IOException;
175:
176: }
|