1 // Copyright 2008 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.tools
.development
;
5 import com
.google
.apphosting
.utils
.config
.AppEngineWebXml
;
6 import com
.google
.apphosting
.utils
.config
.BackendsXml
;
12 * Provides the backing servlet container support for the {@link DevAppServer},
13 * as discovered via {@link ServiceProvider}.
15 * More specifically, this interface encapsulates the interactions between the
16 * {@link DevAppServer} and the underlying servlet container, which by default
20 public interface ContainerService
{
23 * The severity with which we'll treat environment variable mismatches.
25 enum EnvironmentVariableMismatchSeverity
{
32 * Sets up the necessary configuration parameters.
34 * @param devAppServerVersion Version of the devAppServer.
35 * @param appDir The location of the application to run.
36 * @param externalResourceDir If not {@code null}, a resource directory external to the appDir.
37 * This will be searched before appDir when looking for resources.
38 * @param webXmlLocation The location of a file whose format complies with
39 * http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd. If null we will use
40 * <appDir>/WEB-INF/web.xml.
41 * @param appEngineWebXmlLocation The location of the app engine config file.
42 * If null we will use <appDir>/WEB-INF/appengine-web.xml.
43 * @param address The address on which the server will run
44 * @param port The port to which the server will be bound. If 0, an
45 * available port will be selected.
46 * @param containerConfigProperties Additional properties used in the
47 * configuration of the specific container implementation. This map travels
48 * across classloader boundaries, so all values in the map must be JRE
51 * @return A LocalServerEnvironment describing the environment in which
52 * the server is running.
54 LocalServerEnvironment
configure(String devAppServerVersion
, File appDir
,
55 File externalResourceDir
, File webXmlLocation
, File appEngineWebXmlLocation
,
56 String address
, int port
, Map
<String
, Object
> containerConfigProperties
);
59 * Starts up the servlet container.
61 * @throws Exception Any exception from the container will be rethrown as is.
63 void startup() throws Exception
;
66 * Shuts down the servlet container.
68 * @throws Exception Any exception from the container will be rethrown as is.
70 void shutdown() throws Exception
;
73 * Returns the listener network address, however it's decided during
74 * the servlet container deployment.
79 * Returns the listener port number, however it's decided during the servlet
80 * container deployment.
85 * Returns the host name of the server, however it's decided during the
86 * the servlet container deployment.
91 * Returns the context representing the currently executing webapp.
93 AppContext
getAppContext();
96 * Return the AppEngineWebXml configuration of this container
98 AppEngineWebXml
getAppEngineWebXmlConfig();
100 BackendsXml
getBackendsXml();
103 * Overrides the default EnvironmentVariableMismatchSeverity setting, to
104 * disable exceptions during the testing.
106 * @param val The new EnvironmentVariableMismatchSeverity.
107 * @see EnvironmentVariableMismatchSeverity
109 void setEnvironmentVariableMismatchSeverity(EnvironmentVariableMismatchSeverity val
);
112 * Get a set of properties to be passed to each service, based on the
113 * AppEngineWebXml configuration.
115 * @return the map of properties to be passed to each service.
117 Map
<String
, String
> getServiceProperties();