1 // ========================================================================
2 // Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
3 // ------------------------------------------------------------------------
4 // All rights reserved. This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v1.0
6 // and Apache License v2.0 which accompanies this distribution.
7 // The Eclipse Public License is available at
8 // http://www.eclipse.org/legal/epl-v10.html
9 // The Apache License v2.0 is available at
10 // http://www.opensource.org/licenses/apache2.0.php
11 // You may elect to redistribute this code under either of these licenses.
12 // ========================================================================
13
14 package org.eclipse.jetty.webapp;
15
16
17 /* ------------------------------------------------------------------------------- */
18 /** Base Class for WebApplicationContext Configuration.
19 * This class can be extended to customize or extend the configuration
20 * of the WebApplicationContext.
21 */
22 public interface Configuration
23 {
24
25 /* ------------------------------------------------------------------------------- */
26 /** Set up for configuration.
27 * <p>
28 * Typically this step discovers configuration resources
29 * @param context The context to configure
30 * @throws Exception
31 */
32 public void preConfigure (WebAppContext context) throws Exception;
33
34
35 /* ------------------------------------------------------------------------------- */
36 /** Configure WebApp.
37 * <p>
38 * Typically this step applies the discovered configuration resources to
39 * either the {@link WebAppContext} or the associated {@link MetaData}.
40 * @param context The context to configure
41 * @throws Exception
42 */
43 public void configure (WebAppContext context) throws Exception;
44
45
46 /* ------------------------------------------------------------------------------- */
47 /** Clear down after configuration.
48 * @param context The context to configure
49 * @throws Exception
50 */
51 public void postConfigure (WebAppContext context) throws Exception;
52
53 /* ------------------------------------------------------------------------------- */
54 /** DeConfigure WebApp.
55 * This method is called to undo all configuration done. This is
56 * called to allow the context to work correctly over a stop/start cycle
57 * @param context The context to configure
58 * @throws Exception
59 */
60 public void deconfigure (WebAppContext context) throws Exception;
61
62 /* ------------------------------------------------------------------------------- */
63 /** Destroy WebApp.
64 * This method is called to destroy a webappcontext. It is typically called when a context
65 * is removed from a server handler hierarchy by the deployer.
66 * @param context The context to configure
67 * @throws Exception
68 */
69 public void destroy (WebAppContext context) throws Exception;
70
71
72 /* ------------------------------------------------------------------------------- */
73 /** Clone configuration instance.
74 * <p>
75 * Configure an instance of a WebAppContext, based on a template WebAppContext that
76 * has previously been configured by this Configuration.
77 * @param template The template context
78 * @param context The context to configure
79 * @throws Exception
80 */
81 public void cloneConfigure (WebAppContext template, WebAppContext context) throws Exception;
82 }