View Javadoc

1   // ========================================================================
2   // Copyright (c) 2010 Intalio, Inc.
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  // Contributors:
13  //    Hugues Malphettes - initial API and implementation
14  // ========================================================================
15  package org.eclipse.jetty.osgi.boot.internal.webapp;
16  
17  import org.eclipse.jetty.deploy.ContextDeployer;
18  import org.eclipse.jetty.server.handler.ContextHandler;
19  import org.eclipse.jetty.webapp.WebAppContext;
20  import org.osgi.framework.Bundle;
21  
22  /**
23   * Internal interface for the class that deploys a webapp on a server.
24   * Used as we migrate from the single instance of the jety server to multiple jetty servers.
25   */
26  public interface IWebBundleDeployerHelper {
27  
28      /** when this property is present, the type of context handler registered is not
29       * known in advance. */
30      public static final String INTERNAL_SERVICE_PROP_UNKNOWN_CONTEXT_HANDLER_TYPE = "unknownContextHandlerType";
31  
32  	
33  	/**
34  	 * Deploy a new web application on the jetty server.
35  	 * 
36  	 * @param bundle
37  	 *            The bundle
38  	 * @param webappFolderPath
39  	 *            The path to the root of the webapp. Must be a path relative to
40  	 *            bundle; either an absolute path.
41  	 * @param contextPath
42  	 *            The context path. Must start with "/"
43  	 * @param extraClasspath
44  	 * @param overrideBundleInstallLocation
45  	 * @param webXmlPath
46  	 * @param defaultWebXmlPath
47  	 *            TODO: parameter description
48  	 * @return The contexthandler created and started
49  	 * @throws Exception
50  	 */
51  	public abstract WebAppContext registerWebapplication(Bundle bundle,
52  			String webappFolderPath, String contextPath, String extraClasspath,
53  			String overrideBundleInstallLocation, String webXmlPath,
54  			String defaultWebXmlPath, WebAppContext webAppContext) throws Exception;
55  
56  	/**
57  	 * Stop a ContextHandler and remove it from the collection.
58  	 * 
59  	 * @see ContextDeployer#undeploy
60  	 * @param contextHandler
61  	 * @throws Exception
62  	 */
63  	public abstract void unregister(ContextHandler contextHandler)
64  			throws Exception;
65  
66  	/**
67  	 * This type of registration relies on jetty's complete context xml file.
68  	 * Context encompasses jndi and all other things. This makes the definition
69  	 * of the webapp a lot more self-contained.
70  	 * 
71  	 * @param contributor
72  	 * @param contextFileRelativePath
73  	 * @param extraClasspath
74  	 * @param overrideBundleInstallLocation
75  	 * @param handler the context handler passed in the server
76  	 * reference that will be configured, deployed and started.
77  	 * @return The contexthandler created and started
78  	 * @throws Exception
79  	 */
80  	public abstract ContextHandler registerContext(Bundle contributor,
81  			String contextFileRelativePath, String extraClasspath,
82  			String overrideBundleInstallLocation, ContextHandler handler) throws Exception;
83  
84  }