Class AbstractContainerService

java.lang.Object
com.google.appengine.tools.development.AbstractContainerService
All Implemented Interfaces:
ContainerService

public abstract class AbstractContainerService extends Object implements ContainerService
Common implementation for the ContainerService interface.

There should be no reference to any third-party servlet container from here.

  • Field Details

  • Constructor Details

    • AbstractContainerService

      public AbstractContainerService()
  • Method Details

    • configure

      public final LocalServerEnvironment configure(String devAppServerVersion, String address, int port, ApplicationConfigurationManager.ModuleConfigurationHandle moduleConfigurationHandle, File externalResourceDir, Map<String,Object> containerConfigProperties, int instance, DevAppServer devAppServer)
      Description copied from interface: ContainerService
      Sets up the necessary configuration parameters.
      Specified by:
      configure in interface ContainerService
      Parameters:
      devAppServerVersion - Version of the devAppServer.
      address - The address on which the module instance will run
      port - The port to which the module instance will be bound. If 0, an available port will be selected.
      moduleConfigurationHandle - Handle to access and reread the configuration.
      externalResourceDir - If not null, a resource directory external to the applicationDirectory. This will be searched before applicationDirectory when looking for resources.
      containerConfigProperties - Additional properties used in the configuration of the specific container implementation. This map travels across classloader boundaries, so all values in the map must be JRE classes.
      instance - the 0 based instance number for this container's instance or LocalEnvironment.MAIN_INSTANCE.
      Returns:
      A LocalServerEnvironment describing the environment in which the module instance is running.
    • setApiProxyDelegate

      public void setApiProxyDelegate(ApiProxy.Delegate<?> apiProxyDelegate)
      Description copied from interface: ContainerService
      Sets the ApiProxy.Delegate.

      Note that this provides access to the original delegate which was established by the DevAppServer. Though this delegate is usually available by calling the delegate can be changed by the application so we keep this reference to the original.

      Specified by:
      setApiProxyDelegate in interface ContainerService
      Parameters:
      apiProxyDelegate -
    • createConnection

      public final void createConnection() throws Exception
      Description copied from interface: ContainerService
      Create's this containers network connections. After this returns ContainerService.getAddress(), ContainerService.getPort() and ContainerService.getHostName() return correct values for this container.
      Specified by:
      createConnection in interface ContainerService
      Throws:
      Exception
    • startup

      public final void startup() throws Exception
      Description copied from interface: ContainerService
      Starts up the servlet container.
      Specified by:
      startup in interface ContainerService
      Throws:
      Exception - Any exception from the container will be rethrown as is.
    • shutdown

      public final void shutdown() throws Exception
      Description copied from interface: ContainerService
      Shuts down the servlet container.
      Specified by:
      shutdown in interface ContainerService
      Throws:
      Exception - Any exception from the container will be rethrown as is.
    • getServiceProperties

      public Map<String,String> getServiceProperties()
      Description copied from interface: ContainerService
      Get a set of properties to be passed to each service, based on the AppEngineWebXml configuration.
      Specified by:
      getServiceProperties in interface ContainerService
      Returns:
      the map of properties to be passed to each service.
    • getAddress

      public String getAddress()
      Description copied from interface: ContainerService
      Returns the listener network address, however it's decided during the servlet container deployment.
      Specified by:
      getAddress in interface ContainerService
    • getAppEngineWebXmlConfig

      public com.google.apphosting.utils.config.AppEngineWebXml getAppEngineWebXmlConfig()
      Description copied from interface: ContainerService
      Return the AppEngineWebXml configuration of this container
      Specified by:
      getAppEngineWebXmlConfig in interface ContainerService
    • getPort

      public int getPort()
      Description copied from interface: ContainerService
      Returns the listener port number, however it's decided during the servlet container deployment.
      Specified by:
      getPort in interface ContainerService
    • getHostName

      public String getHostName()
      Description copied from interface: ContainerService
      Returns the host name of the module instance, however it's decided during the the servlet container deployment.
      Specified by:
      getHostName in interface ContainerService
    • installLocalInitializationEnvironment

      public static void installLocalInitializationEnvironment(com.google.apphosting.utils.config.AppEngineWebXml appEngineWebXml, int instance, int port, int defaultModuleMainPort, String backendName, int backendInstance, Map<String,String> portMapping)
      Sets up an ApiProxy.Environment for container initialization.