View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 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  
19  package org.eclipse.jetty.osgi.boot.internal.webapp;
20  
21  import org.eclipse.jetty.server.handler.ContextHandler;
22  import org.eclipse.jetty.webapp.WebAppContext;
23  import org.osgi.framework.Bundle;
24  
25  /**
26   * Internal interface for the class that deploys a webapp on a server. Used as
27   * we migrate from the single instance of the jety server to multiple jetty
28   * servers.
29   */
30  public interface IWebBundleDeployerHelper
31  {
32  
33      /**
34       * when this property is present, the type of context handler registered is
35       * not known in advance.
36       */
37      public static final String INTERNAL_SERVICE_PROP_UNKNOWN_CONTEXT_HANDLER_TYPE = "unknownContextHandlerType";
38  
39      /**
40       * Deploy a new web application on the jetty server.
41       * 
42       * @param bundle The bundle
43       * @param webappFolderPath The path to the root of the webapp. Must be a
44       *            path relative to bundle; either an absolute path.
45       * @param contextPath The context path. Must start with "/"
46       * @param extraClasspath
47       * @param overrideBundleInstallLocation
48       * @param requireTldBundle The list of bundles's symbolic names that contain
49       *            tld files that are required by this WAB.
50       * @param webXmlPath
51       * @param defaultWebXmlPath TODO: parameter description
52       * @return The contexthandler created and started
53       * @throws Exception
54       */
55      public abstract WebAppContext registerWebapplication(Bundle bundle, String webappFolderPath, String contextPath, String extraClasspath,
56                                                           String overrideBundleInstallLocation, 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) throws Exception;
67  
68      /**
69       * This type of registration relies on jetty's complete context xml file.
70       * Context encompasses jndi and all other things. This makes the definition
71       * of the webapp a lot more self-contained.
72       * 
73       * @param contributor
74       * @param contextFileRelativePath
75       * @param extraClasspath
76       * @param overrideBundleInstallLocation
77       * @param requireTldBundle The list of bundles'symbolic name that contain
78       *            tld files for this webapp.
79       * @param handler the context handler passed in the server reference that
80       *            will be configured, deployed and started.
81       * @return The contexthandler created and started
82       * @throws Exception
83       */
84      public abstract ContextHandler registerContext(Bundle contributor, String contextFileRelativePath, String extraClasspath,
85                                                     String overrideBundleInstallLocation, String requireTldBundle, ContextHandler handler) throws Exception;
86  
87  }