001: /*
002: * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/EmbeddedManagerMBean.java,v 1.4 2001/07/22 20:25:13 pier Exp $
003: * $Revision: 1.4 $
004: * $Date: 2001/07/22 20:25:13 $
005: *
006: * ====================================================================
007: *
008: * The Apache Software License, Version 1.1
009: *
010: * Copyright (c) 1999 The Apache Software Foundation. All rights
011: * reserved.
012: *
013: * Redistribution and use in source and binary forms, with or without
014: * modification, are permitted provided that the following conditions
015: * are met:
016: *
017: * 1. Redistributions of source code must retain the above copyright
018: * notice, this list of conditions and the following disclaimer.
019: *
020: * 2. Redistributions in binary form must reproduce the above copyright
021: * notice, this list of conditions and the following disclaimer in
022: * the documentation and/or other materials provided with the
023: * distribution.
024: *
025: * 3. The end-user documentation included with the redistribution, if
026: * any, must include the following acknowlegement:
027: * "This product includes software developed by the
028: * Apache Software Foundation (http://www.apache.org/)."
029: * Alternately, this acknowlegement may appear in the software itself,
030: * if and wherever such third-party acknowlegements normally appear.
031: *
032: * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
033: * Foundation" must not be used to endorse or promote products derived
034: * from this software without prior written permission. For written
035: * permission, please contact apache@apache.org.
036: *
037: * 5. Products derived from this software may not be called "Apache"
038: * nor may "Apache" appear in their names without prior written
039: * permission of the Apache Group.
040: *
041: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
042: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
043: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
044: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
045: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
046: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
047: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
048: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
049: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
050: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
051: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
052: * SUCH DAMAGE.
053: * ====================================================================
054: *
055: * This software consists of voluntary contributions made by many
056: * individuals on behalf of the Apache Software Foundation. For more
057: * information on the Apache Software Foundation, please see
058: * <http://www.apache.org/>.
059: *
060: * [Additional notices, if required by prior licensing conditions]
061: *
062: */
063:
064: package org.apache.catalina.startup;
065:
066: import java.net.InetAddress;
067: import org.apache.catalina.Connector;
068: import org.apache.catalina.Container;
069: import org.apache.catalina.Context;
070: import org.apache.catalina.Engine;
071: import org.apache.catalina.Host;
072: import org.apache.catalina.Lifecycle;
073: import org.apache.catalina.LifecycleEvent;
074: import org.apache.catalina.LifecycleException;
075: import org.apache.catalina.LifecycleListener;
076: import org.apache.catalina.Logger;
077: import org.apache.catalina.Realm;
078: import org.apache.catalina.connector.http.HttpConnector;
079:
080: /**
081: * Embedded MBean interface.
082: *
083: * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
084: * @version $Revision: 1.4 $
085: */
086:
087: public interface EmbeddedManagerMBean {
088:
089: // -------------------------------------------------------------- Constants
090:
091: /**
092: * Status constants.
093: */
094: public static final String[] states = { "Stopped", "Stopping",
095: "Starting", "Started" };
096:
097: public static final int STOPPED = 0;
098: public static final int STOPPING = 1;
099: public static final int STARTING = 2;
100: public static final int STARTED = 3;
101:
102: /**
103: * Component name.
104: */
105: public static final String NAME = "Catalina servlet container";
106:
107: /**
108: * Object name.
109: */
110: public static final String OBJECT_NAME = ":service=Catalina";
111:
112: // ------------------------------------------------------ Interface Methods
113:
114: /**
115: * Retruns the Catalina component name.
116: */
117: public String getName();
118:
119: /**
120: * Returns the state.
121: */
122: public int getState();
123:
124: /**
125: * Returns a String representation of the state.
126: */
127: public String getStateString();
128:
129: /**
130: * Return the debugging detail level for this component.
131: */
132: public int getDebug();
133:
134: /**
135: * Set the debugging detail level for this component.
136: *
137: * @param debug The new debugging detail level
138: */
139: public void setDebug(int debug);
140:
141: /**
142: * Return true if naming is enabled.
143: */
144: public boolean isUseNaming();
145:
146: /**
147: * Enables or disables naming support.
148: *
149: * @param useNaming The new use naming value
150: */
151: public void setUseNaming(boolean useNaming);
152:
153: /**
154: * Return the Logger for this component.
155: */
156: public Logger getLogger();
157:
158: /**
159: * Set the Logger for this component.
160: *
161: * @param logger The new logger
162: */
163: public void setLogger(Logger logger);
164:
165: /**
166: * Return the default Realm for our Containers.
167: */
168: public Realm getRealm();
169:
170: /**
171: * Set the default Realm for our Containers.
172: *
173: * @param realm The new default realm
174: */
175: public void setRealm(Realm realm);
176:
177: /**
178: * Return the secure socket factory class name.
179: */
180: public String getSocketFactory();
181:
182: /**
183: * Set the secure socket factory class name.
184: *
185: * @param socketFactory The new secure socket factory class name
186: */
187: public void setSocketFactory(String socketFactory);
188:
189: /**
190: * Add a new Connector to the set of defined Connectors. The newly
191: * added Connector will be associated with the most recently added Engine.
192: *
193: * @param connector The connector to be added
194: *
195: * @exception IllegalStateException if no engines have been added yet
196: */
197: public void addConnector(Connector connector);
198:
199: /**
200: * Add a new Engine to the set of defined Engines.
201: *
202: * @param engine The engine to be added
203: */
204: public void addEngine(Engine engine);
205:
206: /**
207: * Create, configure, and return a new TCP/IP socket connector
208: * based on the specified properties.
209: *
210: * @param address InetAddress to listen to, or <code>null</code>
211: * to listen on all address on this server
212: * @param port Port number to listen to
213: * @param secure Should this port be SSL-enabled?
214: */
215: public Connector createConnector(InetAddress address, int port,
216: boolean secure);
217:
218: /**
219: * Create, configure, and return a Context that will process all
220: * HTTP requests received from one of the associated Connectors,
221: * and directed to the specified context path on the virtual host
222: * to which this Context is connected.
223: * <p>
224: * After you have customized the properties, listeners, and Valves
225: * for this Context, you must attach it to the corresponding Host
226: * by calling:
227: * <pre>
228: * host.addChild(context);
229: * </pre>
230: * which will also cause the Context to be started if the Host has
231: * already been started.
232: *
233: * @param path Context path of this application ("" for the default
234: * application for this host, must start with a slash otherwise)
235: * @param docBase Absolute pathname to the document base directory
236: * for this web application
237: *
238: * @exception IllegalArgumentException if an invalid parameter
239: * is specified
240: */
241: public Context createContext(String path, String docBase);
242:
243: /**
244: * Create, configure, and return an Engine that will process all
245: * HTTP requests received from one of the associated Connectors,
246: * based on the specified properties.
247: */
248: public Engine createEngine();
249:
250: /**
251: * Create, configure, and return a Host that will process all
252: * HTTP requests received from one of the associated Connectors,
253: * and directed to the specified virtual host.
254: * <p>
255: * After you have customized the properties, listeners, and Valves
256: * for this Host, you must attach it to the corresponding Engine
257: * by calling:
258: * <pre>
259: * engine.addChild(host);
260: * </pre>
261: * which will also cause the Host to be started if the Engine has
262: * already been started. If this is the default (or only) Host you
263: * will be defining, you may also tell the Engine to pass all requests
264: * not assigned to another virtual host to this one:
265: * <pre>
266: * engine.setDefaultHost(host.getName());
267: * </pre>
268: *
269: * @param name Canonical name of this virtual host
270: * @param appBase Absolute pathname to the application base directory
271: * for this virtual host
272: *
273: * @exception IllegalArgumentException if an invalid parameter
274: * is specified
275: */
276: public Host createHost(String name, String appBase);
277:
278: /**
279: * Return descriptive information about this Server implementation and
280: * the corresponding version number, in the format
281: * <code><description>/<version></code>.
282: */
283: public String getInfo();
284:
285: /**
286: * Remove the specified Connector from the set of defined Connectors.
287: *
288: * @param connector The Connector to be removed
289: */
290: public void removeConnector(Connector connector);
291:
292: /**
293: * Remove the specified Context from the set of defined Contexts for its
294: * associated Host. If this is the last Context for this Host, the Host
295: * will also be removed.
296: *
297: * @param context The Context to be removed
298: */
299: public void removeContext(Context context);
300:
301: /**
302: * Remove the specified Engine from the set of defined Engines, along with
303: * all of its related Hosts and Contexts. All associated Connectors are
304: * also removed.
305: *
306: * @param engine The Engine to be removed
307: */
308: public void removeEngine(Engine engine);
309:
310: /**
311: * Remove the specified Host, along with all of its related Contexts,
312: * from the set of defined Hosts for its associated Engine. If this is
313: * the last Host for this Engine, the Engine will also be removed.
314: *
315: * @param host The Host to be removed
316: */
317: public void removeHost(Host host);
318:
319: /**
320: * Prepare for the beginning of active use of the public methods of this
321: * component. This method should be called after <code>configure()</code>,
322: * and before any of the public methods of the component are utilized.
323: *
324: * @exception IllegalStateException if this component has already been
325: * started
326: */
327: public void start();
328:
329: /**
330: * Gracefully terminate the active use of the public methods of this
331: * component. This method should be the last one called on a given
332: * instance of this component.
333: *
334: * @exception IllegalStateException if this component has not been started
335: */
336: public void stop();
337:
338: /**
339: * Destroy servlet container (if any is running).
340: */
341: public void destroy();
342:
343: }
|