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