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.deploy.ContextDeployer;
22  import org.eclipse.jetty.server.handler.ContextHandler;
23  import org.eclipse.jetty.webapp.WebAppContext;
24  import org.osgi.framework.Bundle;
25  
26  /**
27   * Internal interface for the class that deploys a webapp on a server. Used as
28   * we migrate from the single instance of the jety server to multiple jetty
29   * servers.
30   */
31  public interface IWebBundleDeployerHelper
32  {
33  
34      /**
35       * when this property is present, the type of context handler registered is
36       * not known in advance.
37       */
38      public static final String INTERNAL_SERVICE_PROP_UNKNOWN_CONTEXT_HANDLER_TYPE = "unknownContextHandlerType";
39  
40      /**
41       * Deploy a new web application on the jetty server.
42       * 
43       * @param bundle The bundle
44       * @param webappFolderPath The path to the root of the webapp. Must be a
45       *            path relative to bundle; either an absolute path.
46       * @param contextPath The context path. Must start with "/"
47       * @param extraClasspath
48       * @param overrideBundleInstallLocation
49       * @param requireTldBundle The list of bundles's symbolic names that contain
50       *            tld files that are required by this WAB.
51       * @param webXmlPath
52       * @param defaultWebXmlPath TODO: parameter description
53       * @return The contexthandler created and started
54       * @throws Exception
55       */
56      public abstract WebAppContext registerWebapplication(Bundle bundle, String webappFolderPath, String contextPath, String extraClasspath,
57                                                           String overrideBundleInstallLocation, String requireTldBundle, String webXmlPath,
58                                                           String defaultWebXmlPath, WebAppContext webAppContext) throws Exception;
59  
60      /**
61       * Stop a ContextHandler and remove it from the collection.
62       * 
63       * @see ContextDeployer#undeploy
64       * @param contextHandler
65       * @throws Exception
66       */
67      public abstract void unregister(ContextHandler contextHandler) 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
79       *            tld files for this webapp.
80       * @param handler the context handler passed in the server reference that
81       *            will be configured, deployed and started.
82       * @return The contexthandler created and started
83       * @throws Exception
84       */
85      public abstract ContextHandler registerContext(Bundle contributor, String contextFileRelativePath, String extraClasspath,
86                                                     String overrideBundleInstallLocation, String requireTldBundle, ContextHandler handler) throws Exception;
87  
88  }