com.caucho.server.host
Class Host

java.lang.Object
  extended by com.caucho.server.host.Host
All Implemented Interfaces:
SchemaBean, DeployInstance, EnvironmentDeployInstance, EnvironmentBean, InvocationBuilder, Dependency

public class Host
extends java.lang.Object
implements EnvironmentBean, Dependency, SchemaBean, EnvironmentDeployInstance, InvocationBuilder

Resin's virtual host implementation.


Constructor Summary
Host(HostContainer parent, HostController controller, java.lang.String hostName)
          Creates the webApp with its environment loader.
 
Method Summary
 void add(DispatchRule dispatchRule)
          Adds a rewrite dispatch rule
 void add(RewriteFilter dispatchAction)
          Adds a rewrite dispatch rule
 void addEarDefault(EarConfig config)
           
 void addEarDeploy(EarDeployGenerator earDeploy)
          Adds the ear-expansion
 void addErrorPage(ErrorPage errorPage)
           
 void addHostAlias(java.lang.String name)
          Adds an alias.
 void addHostAliasRegexp(java.lang.String name)
          Adds an alias.
 void addWarDeploy(WebAppExpandDeployGenerator webAppDeploy)
          Sets the war-expansion
 void addWebApp(WebAppConfig config)
           
 void addWebAppDefault(WebAppConfig config)
           
 void addWebAppDeploy(WebAppExpandDeployGenerator deploy)
          Sets the war-expansion
 Invocation buildInvocation(Invocation invocation)
          Builds the invocation for the host.
static java.lang.String calculateCanonicalIPv6(java.lang.String host)
           
 void clearCache()
          Clears the cache
 EarDeployGenerator createEarDeploy()
          Sets the ear-expansion
 RewriteDispatch createRewriteDispatch()
          Adds rewrite-dispatch (backward compat).
 WebAppExpandDeployGenerator createWarDeploy()
          Sets the war-expansion
 WebAppExpandDeployGenerator createWebAppDeploy()
          Sets the war-expansion
 void destroy()
          Closes the host.
 HostMXBean getAdmin()
          Returns the admin.
 java.util.ArrayList<java.lang.String> getAliasList()
          Gets the alias list.
 Broker getBamBroker()
          Returns the bam broker.
 EnvironmentClassLoader getClassLoader()
          Gets the environment class loader.
 CloudCluster getCluster()
          Returns the current cluster.
 java.lang.String getConfigETag()
          Returns the config etag.
 java.lang.Throwable getConfigException()
          Gets the config exception.
 ErrorPageManager getErrorPageManager()
           
 java.lang.String getHostName()
          Returns the canonical host name.
 java.lang.String getId()
          Returns id for the host
 java.lang.String getIdTail()
           
static Host getLocal()
          Returns the local host.
 java.lang.String getName()
          Returns the entry name
 Path getRootDirectory()
           
 java.lang.String getSchema()
          Returns the relax schema.
 java.lang.String getSecureHostName()
          Returns the secure host name.
 Server getServer()
          Returns the owning server.
 LifecycleState getState()
           
 java.lang.String getURL()
          Returns the URL for the container.
 WebAppContainer getWebAppContainer()
           
 void init()
          Initialize the instance.
 boolean isDefaultHost()
          Returns true if matches the default host.
 boolean isDeployError()
          Returns true if the host deploy was an error
 boolean isDeployIdle()
          Returns true if the host is idle
 boolean isModified()
          Returns true if the host is modified.
 boolean isModifiedNow()
          Returns true if the host is modified.
 java.lang.Boolean isRequestSecure()
           
 boolean logModified(java.util.logging.Logger log)
          Log the reason for modification.
 void preConfigInit()
          Initialization before configuration
 void setAccessLog(AccessLog log)
           
 void setConfigETag(java.lang.String etag)
          Returns the config etag.
 void setConfigException(java.lang.Throwable e)
          Sets the config exception.
 void setDocumentDirectory(Path docDir)
          Sets the doc dir.
 void setSecureHostName(java.lang.String secureHostName)
          Sets the secure host name.
 void setSetRequestSecure(boolean isSecure)
           
 void setWarDir(Path warDir)
          Sets the war-dir for backwards compatibility.
 void setWarExpandDir(Path warDir)
          Sets the war-expand-dir.
 void start()
          Starts the host.
 boolean stop()
          Stops the host.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Host

public Host(HostContainer parent,
            HostController controller,
            java.lang.String hostName)
Creates the webApp with its environment loader.

Method Detail

getLocal

public static Host getLocal()
Returns the local host.


getName

public java.lang.String getName()
Returns the entry name


getHostName

public java.lang.String getHostName()
Returns the canonical host name. The canonical host name may include the port.


getSecureHostName

public java.lang.String getSecureHostName()
Returns the secure host name. Used for redirects.


setSecureHostName

public void setSecureHostName(java.lang.String secureHostName)
Sets the secure host name. Used for redirects.


setSetRequestSecure

public void setSetRequestSecure(boolean isSecure)

isRequestSecure

public java.lang.Boolean isRequestSecure()

getBamBroker

public Broker getBamBroker()
Returns the bam broker.


getSchema

public java.lang.String getSchema()
Returns the relax schema.

Specified by:
getSchema in interface SchemaBean

getId

public java.lang.String getId()
Returns id for the host


getIdTail

public java.lang.String getIdTail()

getURL

public java.lang.String getURL()
Returns the URL for the container.


addHostAlias

public void addHostAlias(java.lang.String name)
Adds an alias.


getState

public LifecycleState getState()

getAliasList

public java.util.ArrayList<java.lang.String> getAliasList()
Gets the alias list.


addHostAliasRegexp

@Configurable
public void addHostAliasRegexp(java.lang.String name)
Adds an alias.


isDefaultHost

public boolean isDefaultHost()
Returns true if matches the default host.


getClassLoader

public EnvironmentClassLoader getClassLoader()
Gets the environment class loader.

Specified by:
getClassLoader in interface DeployInstance
Specified by:
getClassLoader in interface EnvironmentBean

getRootDirectory

public Path getRootDirectory()

setAccessLog

@Configurable
public void setAccessLog(AccessLog log)

setDocumentDirectory

public void setDocumentDirectory(Path docDir)
Sets the doc dir.


getWebAppContainer

public WebAppContainer getWebAppContainer()

addErrorPage

@Configurable
public void addErrorPage(ErrorPage errorPage)

getErrorPageManager

public ErrorPageManager getErrorPageManager()

addWebApp

@Configurable
public void addWebApp(WebAppConfig config)

addWebAppDefault

@Configurable
public void addWebAppDefault(WebAppConfig config)

createWarDeploy

@Configurable
public WebAppExpandDeployGenerator createWarDeploy()
Sets the war-expansion


addWarDeploy

@Configurable
public void addWarDeploy(WebAppExpandDeployGenerator webAppDeploy)
                  throws ConfigException
Sets the war-expansion

Throws:
ConfigException

createWebAppDeploy

@Configurable
public WebAppExpandDeployGenerator createWebAppDeploy()
Sets the war-expansion


addWebAppDeploy

public void addWebAppDeploy(WebAppExpandDeployGenerator deploy)
                     throws ConfigException
Sets the war-expansion

Throws:
ConfigException

createEarDeploy

@Configurable
public EarDeployGenerator createEarDeploy()
                                   throws java.lang.Exception
Sets the ear-expansion

Throws:
java.lang.Exception

addEarDeploy

@Configurable
public void addEarDeploy(EarDeployGenerator earDeploy)
                  throws java.lang.Exception
Adds the ear-expansion

Throws:
java.lang.Exception

addEarDefault

@Configurable
public void addEarDefault(EarConfig config)

setWarDir

@Configurable
public void setWarDir(Path warDir)
               throws ConfigException
Sets the war-dir for backwards compatibility.

Throws:
ConfigException

setWarExpandDir

public void setWarExpandDir(Path warDir)
Sets the war-expand-dir.


add

public void add(DispatchRule dispatchRule)
Adds a rewrite dispatch rule


add

public void add(RewriteFilter dispatchAction)
Adds a rewrite dispatch rule


createRewriteDispatch

public RewriteDispatch createRewriteDispatch()
Adds rewrite-dispatch (backward compat).


setConfigException

public void setConfigException(java.lang.Throwable e)
Sets the config exception.

Specified by:
setConfigException in interface DeployInstance

getConfigException

public java.lang.Throwable getConfigException()
Gets the config exception.

Specified by:
getConfigException in interface DeployInstance

getServer

public Server getServer()
Returns the owning server.


getCluster

public CloudCluster getCluster()
Returns the current cluster.


getConfigETag

public java.lang.String getConfigETag()
Returns the config etag.


setConfigETag

public void setConfigETag(java.lang.String etag)
Returns the config etag.


getAdmin

public HostMXBean getAdmin()
Returns the admin.


preConfigInit

public void preConfigInit()
Initialization before configuration

Specified by:
preConfigInit in interface EnvironmentDeployInstance

init

public void init()
Description copied from interface: EnvironmentDeployInstance
Initialize the instance.

Specified by:
init in interface EnvironmentDeployInstance

start

public void start()
Starts the host.

Specified by:
start in interface DeployInstance

clearCache

public void clearCache()
Clears the cache


buildInvocation

public Invocation buildInvocation(Invocation invocation)
                           throws ConfigException
Builds the invocation for the host.

Specified by:
buildInvocation in interface InvocationBuilder
Throws:
ConfigException

isModified

public boolean isModified()
Returns true if the host is modified.

Specified by:
isModified in interface DeployInstance
Specified by:
isModified in interface Dependency

isModifiedNow

public boolean isModifiedNow()
Returns true if the host is modified.

Specified by:
isModifiedNow in interface DeployInstance

logModified

public boolean logModified(java.util.logging.Logger log)
Log the reason for modification.

Specified by:
logModified in interface DeployInstance
Specified by:
logModified in interface Dependency

isDeployError

public boolean isDeployError()
Returns true if the host deploy was an error


isDeployIdle

public boolean isDeployIdle()
Returns true if the host is idle

Specified by:
isDeployIdle in interface DeployInstance

stop

public boolean stop()
Stops the host.


destroy

public void destroy()
Closes the host.

Specified by:
destroy in interface DeployInstance

calculateCanonicalIPv6

public static java.lang.String calculateCanonicalIPv6(java.lang.String host)
Parameters:
shortHost -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object