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 requireTldBundle The list of bundles's symbolic names that contain
46 * tld files that are required by this WAB.
47 * @param webXmlPath
48 * @param defaultWebXmlPath
49 * TODO: parameter description
50 * @return The contexthandler created and started
51 * @throws Exception
52 */
53 public abstract WebAppContext registerWebapplication(Bundle bundle,
54 String webappFolderPath, String contextPath, String extraClasspath,
55 String overrideBundleInstallLocation,
56 String requireTldBundle, String webXmlPath,
57 String defaultWebXmlPath, WebAppContext webAppContext) throws Exception;
58
59 /**
60 * Stop a ContextHandler and remove it from the collection.
61 *
62 * @see ContextDeployer#undeploy
63 * @param contextHandler
64 * @throws Exception
65 */
66 public abstract void unregister(ContextHandler contextHandler)
67 throws Exception;
68
69 /**
70 * This type of registration relies on jetty's complete context xml file.
71 * Context encompasses jndi and all other things. This makes the definition
72 * of the webapp a lot more self-contained.
73 *
74 * @param contributor
75 * @param contextFileRelativePath
76 * @param extraClasspath
77 * @param overrideBundleInstallLocation
78 * @param requireTldBundle The list of bundles'symbolic name that contain tld files for this webapp.
79 * @param handler the context handler passed in the server
80 * reference that will be configured, deployed and started.
81 * @return The contexthandler created and started
82 * @throws Exception
83 */
84 public abstract ContextHandler registerContext(Bundle contributor,
85 String contextFileRelativePath, String extraClasspath,
86 String overrideBundleInstallLocation, String requireTldBundle,
87 ContextHandler handler) throws Exception;
88
89 }