com.cloudera.lib.servlet
Class ServerWebApp

java.lang.Object
  extended by com.cloudera.lib.server.Server
      extended by com.cloudera.lib.servlet.ServerWebApp
All Implemented Interfaces:
EventListener, javax.servlet.ServletContextListener
Direct Known Subclasses:
HoopServer

public abstract class ServerWebApp
extends Server
implements javax.servlet.ServletContextListener

Server subclass that implements ServletContextListener and uses its lifecycle to start and stop the server.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.cloudera.lib.server.Server
Server.Status
 
Field Summary
 
Fields inherited from class com.cloudera.lib.server.Server
CONF_SERVICES, CONF_SERVICES_EXT, CONF_STARTUP_STATUS, DEFAULT_LOG4J_PROPERTIES
 
Constructor Summary
  ServerWebApp(String name)
          Constructor.
protected ServerWebApp(String name, String homeDir, String configDir, String logDir, String tempDir, XConfiguration config)
          Constructor for testing purposes.
protected ServerWebApp(String name, String homeDir, XConfiguration config)
          Constructor for testing purposes.
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent event)
          Destroys the ServletContextListener which destroys the Server.
 void contextInitialized(javax.servlet.ServletContextEvent event)
          Initializes the ServletContextListener which initializes the Server.
static void setHomeDirForCurrentThread(String homeDir)
          Method for testing purposes.
 
Methods inherited from class com.cloudera.lib.server.Server
checkServiceDependencies, destroy, destroyServices, ensureOperational, get, getConfig, getConfigDir, getHomeDir, getLogDir, getName, getPrefix, getPrefixedName, getStatus, getTempDir, init, initConfig, initLog, initServices, loadServices, setService, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerWebApp

protected ServerWebApp(String name,
                       String homeDir,
                       String configDir,
                       String logDir,
                       String tempDir,
                       XConfiguration config)
Constructor for testing purposes.


ServerWebApp

protected ServerWebApp(String name,
                       String homeDir,
                       XConfiguration config)
Constructor for testing purposes.


ServerWebApp

public ServerWebApp(String name)
Constructor. Subclasses must have a default constructor specifying the server name.

The server name is used to resolve the Java System properties that define the server home, config, log and temp directories.

The home directory is looked in the Java System property #SERVER_NAME#.home.dir.

The config directory is looked in the Java System property #SERVER_NAME#.config.dir, if not defined it resolves to the #SERVER_HOME_DIR#/conf directory.

The log directory is looked in the Java System property #SERVER_NAME#.log.dir, if not defined it resolves to the #SERVER_HOME_DIR#/log directory.

The temp directory is looked in the Java System property #SERVER_NAME#.temp.dir, if not defined it resolves to the #SERVER_HOME_DIR#/temp directory.

Parameters:
name - server name.
Method Detail

setHomeDirForCurrentThread

public static void setHomeDirForCurrentThread(String homeDir)
Method for testing purposes.


contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent event)
Initializes the ServletContextListener which initializes the Server.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener
Parameters:
event - servelt context event.

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent event)
Destroys the ServletContextListener which destroys the Server.

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener
Parameters:
event - servelt context event.


Copyright © 2012 Cloudera. All Rights Reserved.