com.caucho.server.webapp
Class WebAppController

java.lang.Object
  extended by com.caucho.env.deploy.DeployController<I>
      extended by com.caucho.env.deploy.ExpandDeployController<I>
          extended by com.caucho.env.deploy.EnvironmentDeployController<WebApp,WebAppConfig>
              extended by com.caucho.server.webapp.WebAppController
All Implemented Interfaces:
DeployActionHandler, DeployControllerApi<WebApp>, RepositoryTagListener, EnvironmentListener, Dependency
Direct Known Subclasses:
UnknownWebAppController, WebAppVersioningController

@Module
public class WebAppController
extends EnvironmentDeployController<WebApp,WebAppConfig>

Manages the lifecycle of a web-app. The same WebAppController is used for each web-app instantiation, for example on restarts. It's only created or destroyed if the web-app-deploy indicates it should be created/destroyed. Each WebAppController corresponds to a DeployNetworkService tag with the name "WebApp/[host]/[context-path]"


Nested Class Summary
 class WebAppController.Var
          EL variables for the app.
 
Field Summary
 
Fields inherited from class com.caucho.env.deploy.ExpandDeployController
APPLICATION_HASH_PATH
 
Fields inherited from class com.caucho.env.deploy.DeployController
_lifecycle, REDEPLOY_CHECK_INTERVAL
 
Constructor Summary
WebAppController(Path rootDirectory, WebAppContainer container, java.lang.String contextPath)
           
WebAppController(java.lang.String id, Path rootDirectory, WebAppContainer container)
           
WebAppController(java.lang.String id, Path rootDirectory, WebAppContainer container, java.lang.String contextPath)
           
 
Method Summary
 void addDepend(Path path)
          Adds a dependent file.
protected  void addDependencies()
          Adding any dependencies.
 void clearCache()
          Clears the
protected  void configureInstanceVariables(WebApp webApp)
          Creates the webApp.
 boolean destroy()
          Destroy the controller
protected  void extendJMXContext(java.util.Map<java.lang.String,java.lang.String> context)
           
protected  void fillInitList(java.util.ArrayList<DeployConfig> initList)
           
 WebAppAdmin getAdmin()
          Returns the admin.
 WebAppContainer getContainer()
          Returns the web-app container.
 java.lang.String getContextPath()
          Returns the webApp's canonical context path, e.g.
 java.lang.String getContextPath(java.lang.String uri)
          Returns the webApp's context path
protected  DeployControllerAdmin<?> getDeployAdmin()
          Returns the deploy admin.
 Host getHost()
          Returns the containing host.
 long getLifetimeClientDisconnectCount()
           
 long getLifetimeConnectionCount()
           
 long getLifetimeConnectionTime()
           
 long getLifetimeReadBytes()
           
 long getLifetimeWriteBytes()
           
protected  java.util.logging.Logger getLog()
          Returns the appropriate log for debugging.
protected  java.lang.String getMBeanId()
           
protected  java.lang.String getMBeanTypeName()
           
 java.lang.String getName()
           
 WebAppController getParent()
          Returns the parent controller.
 java.lang.String getSourceType()
          Returns the source (for backwards compatibility)
 java.lang.String getURL()
          Gets the URL
 WebAppController.Var getVar()
          Returns the var.
 java.lang.String getVersion()
          Gets the version id.
 java.lang.String getWarName()
          Gets the war name prefix.
 WebApp getWebApp()
          Returns the webApp object.
 Server getWebManager()
           
protected  void initBegin()
          Initialize the controller.
protected  void initEnd()
          Initialize the controller.
protected  WebApp instantiateDeployInstance()
          Instantiate the webApp.
 boolean isDynamicDeploy()
          Returns true for a dynamically deployed webApp.
 boolean isInheritSession()
          True for inherit-session webApps.
 boolean isNameMatch(java.lang.String url)
          Returns true if the controller matches.
 boolean isVersionAlias()
          versionAlias is true if a versioned web-app is currently acting as the primary web-app.
protected  boolean isVersioning()
           
protected  void onStartComplete()
           
protected  void onStop()
           
protected  void protectedWebApp()
          Any extra steps needed to deploy the webApp.
protected  void removeExpandFile(Path path, java.lang.String relPath)
          Override to prevent removing of special files.
 void setDynamicDeploy(boolean isDynamicDeploy)
          Set true for a dynamically deployed webApp.
 void setInheritSession(boolean inheritSession)
          True for inherit-session
 void setOldWebApp(WebAppController oldWebApp, long expireTime)
          Sets the old version web-app.
 void setParentWebApp(WebAppController parent)
          Sets the parent controller.
 void setRegexpValues(java.util.ArrayList<java.lang.String> values)
          Sets the regexp values.
 void setSourceType(java.lang.String type)
          Sets the source (for backwards compatibility)
protected  void setVersion(java.lang.String version)
          Sets the version id.
 void setVersionAlias(boolean isVersionAlias)
          versionAlias is true if a versioned web-app is currently acting as the primary web-app.
 void setWarName(java.lang.String warName)
          Sets the war name prefix.
 java.lang.String toString()
          Returns a printable view.
 void updateStatistics(long milliseconds, int readBytes, int writeBytes, boolean isClientDisconnect)
          Update statistics with the results of one request.
 
Methods inherited from class com.caucho.env.deploy.EnvironmentDeployController
addConfigDefault, configureInstance, environmentBind, environmentConfigure, environmentStart, environmentStop, getArchivePath, getConfig, getConfigException, getErrorMessage, getMBean, getObjectName, getPrologue, getRepositoryMetaData, getVariableMap, merge, setConfig, setConfigException, setPrologue
 
Methods inherited from class com.caucho.env.deploy.ExpandDeployController
addExpandCleanupFileSet, addExpandPreserveFileset, addManifestClassPath, controllerLogModified, deploy, deployImpl, equals, getAutoDeployStage, getAutoDeployTag, getManifest, getManifestAttributes, getRepository, getRootDirectory, getVersionDependency, hashCode, isAllowRepository, isControllerModified, isControllerModifiedNow, onActive, onDestroy, onError, onTagChange, postConfigureInstance, postExtract, preConfigureInstance, removeExpandDirectory, removeExpandDirectory, setAllowRepository, setArchivePath, setDependencyCheckInterval, setRootDirectory, setVersionDependency
 
Methods inherited from class com.caucho.env.deploy.DeployController
addLifecycleListener, alarm, close, createDeployInstance, destroyInstance, getActiveDeployInstance, getActiveWaitTime, getControllerType, getDeployInstance, getDeployInstanceImpl, getId, getIdKey, getIdStage, getIdType, getParentClassLoader, getRedeployCheckInterval, getRedeployMode, getStartTime, getStartupMode, getStartupPriority, getState, init, isIdleTimeout, isModified, isModifiedNow, logModified, mergeRedeployCheckInterval, mergeRedeployMode, request, restart, setActiveWaitTimeMillis, setControllerType, setRedeployCheckInterval, setRedeployMode, setStartupMode, setStartupPriority, start, startImpl, startOnInit, stop, stopImpl, stopLazyImpl, subrequest, toRestart, toStart, toStop, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebAppController

public WebAppController(java.lang.String id,
                        Path rootDirectory,
                        WebAppContainer container)

WebAppController

public WebAppController(Path rootDirectory,
                        WebAppContainer container,
                        java.lang.String contextPath)

WebAppController

public WebAppController(java.lang.String id,
                        Path rootDirectory,
                        WebAppContainer container,
                        java.lang.String contextPath)
Method Detail

getName

public java.lang.String getName()

getContextPath

public java.lang.String getContextPath()
Returns the webApp's canonical context path, e.g. /foo-1.0


isVersioning

protected boolean isVersioning()

getContextPath

public java.lang.String getContextPath(java.lang.String uri)
Returns the webApp's context path


setWarName

public void setWarName(java.lang.String warName)
Sets the war name prefix.


getWarName

public java.lang.String getWarName()
Gets the war name prefix.


getURL

public java.lang.String getURL()
Gets the URL


getParent

public WebAppController getParent()
Returns the parent controller.


getContainer

public WebAppContainer getContainer()
Returns the web-app container.


getWebManager

public Server getWebManager()

setParentWebApp

public void setParentWebApp(WebAppController parent)
Sets the parent controller.


getHost

public Host getHost()
Returns the containing host.


getSourceType

public java.lang.String getSourceType()
Returns the source (for backwards compatibility)


setSourceType

public void setSourceType(java.lang.String type)
Sets the source (for backwards compatibility)


setRegexpValues

public void setRegexpValues(java.util.ArrayList<java.lang.String> values)
Sets the regexp values.


isInheritSession

public boolean isInheritSession()
True for inherit-session webApps.


setInheritSession

public void setInheritSession(boolean inheritSession)
True for inherit-session


getWebApp

public WebApp getWebApp()
Returns the webApp object.


setDynamicDeploy

public void setDynamicDeploy(boolean isDynamicDeploy)
Set true for a dynamically deployed webApp.


isDynamicDeploy

public boolean isDynamicDeploy()
Returns true for a dynamically deployed webApp.


getMBeanTypeName

protected java.lang.String getMBeanTypeName()
Overrides:
getMBeanTypeName in class EnvironmentDeployController<WebApp,WebAppConfig>

getMBeanId

protected java.lang.String getMBeanId()
Overrides:
getMBeanId in class EnvironmentDeployController<WebApp,WebAppConfig>

setVersion

protected void setVersion(java.lang.String version)
Sets the version id.


getVersion

public java.lang.String getVersion()
Gets the version id.


setVersionAlias

public void setVersionAlias(boolean isVersionAlias)
versionAlias is true if a versioned web-app is currently acting as the primary web-app.


isVersionAlias

public boolean isVersionAlias()
versionAlias is true if a versioned web-app is currently acting as the primary web-app.


setOldWebApp

public void setOldWebApp(WebAppController oldWebApp,
                         long expireTime)
Sets the old version web-app.


getDeployAdmin

protected DeployControllerAdmin<?> getDeployAdmin()
Returns the deploy admin.

Overrides:
getDeployAdmin in class EnvironmentDeployController<WebApp,WebAppConfig>

initEnd

protected void initEnd()
Description copied from class: EnvironmentDeployController
Initialize the controller.

Overrides:
initEnd in class EnvironmentDeployController<WebApp,WebAppConfig>

getAdmin

public WebAppAdmin getAdmin()
Returns the admin.


isNameMatch

public boolean isNameMatch(java.lang.String url)
Returns true if the controller matches.

Specified by:
isNameMatch in interface DeployControllerApi<WebApp>
Overrides:
isNameMatch in class EnvironmentDeployController<WebApp,WebAppConfig>

getVar

public WebAppController.Var getVar()
Returns the var.


protectedWebApp

protected void protectedWebApp()
                        throws java.lang.Exception
Any extra steps needed to deploy the webApp.

Throws:
java.lang.Exception

addDependencies

protected void addDependencies()
Adding any dependencies.

Overrides:
addDependencies in class ExpandDeployController<WebApp>

addDepend

public void addDepend(Path path)
Adds a dependent file.


initBegin

protected void initBegin()
Initialize the controller.

Overrides:
initBegin in class DeployController<WebApp>

fillInitList

protected void fillInitList(java.util.ArrayList<DeployConfig> initList)
Overrides:
fillInitList in class EnvironmentDeployController<WebApp,WebAppConfig>

instantiateDeployInstance

protected WebApp instantiateDeployInstance()
Instantiate the webApp.

Specified by:
instantiateDeployInstance in class DeployController<WebApp>

configureInstanceVariables

protected void configureInstanceVariables(WebApp webApp)
Creates the webApp.

Overrides:
configureInstanceVariables in class EnvironmentDeployController<WebApp,WebAppConfig>

onStartComplete

protected void onStartComplete()
Overrides:
onStartComplete in class DeployController<WebApp>

onStop

protected void onStop()
Overrides:
onStop in class ExpandDeployController<WebApp>

clearCache

public void clearCache()
Clears the


destroy

public boolean destroy()
Destroy the controller

Overrides:
destroy in class EnvironmentDeployController<WebApp,WebAppConfig>

extendJMXContext

protected void extendJMXContext(java.util.Map<java.lang.String,java.lang.String> context)
Overrides:
extendJMXContext in class EnvironmentDeployController<WebApp,WebAppConfig>

removeExpandFile

protected void removeExpandFile(Path path,
                                java.lang.String relPath)
                         throws java.io.IOException
Override to prevent removing of special files.

Overrides:
removeExpandFile in class ExpandDeployController<WebApp>
Throws:
java.io.IOException

getLifetimeConnectionCount

public long getLifetimeConnectionCount()

getLifetimeConnectionTime

public long getLifetimeConnectionTime()

getLifetimeReadBytes

public long getLifetimeReadBytes()

getLifetimeWriteBytes

public long getLifetimeWriteBytes()

getLifetimeClientDisconnectCount

public long getLifetimeClientDisconnectCount()

updateStatistics

public void updateStatistics(long milliseconds,
                             int readBytes,
                             int writeBytes,
                             boolean isClientDisconnect)
Update statistics with the results of one request.

Parameters:
milliseconds - the number of millesconds for the request
readBytes - the number of bytes read
writeBytes - the number of bytes written
isClientDisconnect - true if the request ended with a client DisconnectException

getLog

protected java.util.logging.Logger getLog()
Description copied from class: DeployController
Returns the appropriate log for debugging.

Overrides:
getLog in class DeployController<WebApp>

toString

public java.lang.String toString()
Returns a printable view.

Overrides:
toString in class EnvironmentDeployController<WebApp,WebAppConfig>