org.ow2.jonas.web.base.proxy
Class HttpOnDemandProxy

java.lang.Object
  extended by org.ow2.jonas.web.base.proxy.HttpOnDemandProxy
All Implemented Interfaces:
Runnable

public class HttpOnDemandProxy
extends Object
implements Runnable

This class provides proxy mechanism.
This is used to intercept requests and then start the web container or deploy the associated war file.

Author:
Florent Benoit

Constructor Summary
HttpOnDemandProxy()
          Default constructor.
 
Method Summary
 void addWar(String warFile)
          Called by the deployer if this proxy is enabled.
 void disable()
          Stop the component
 void enable()
          Start this component.
 ContextInfo getContextInfo(String context)
           
 int getHttpPortNumber()
           
 int getRedirectPortNumber()
           
 ServerSocket getServerSocket()
           
 BaseWebContainerService getWebContainerService()
           
 boolean isAvailableContext(String context)
          Checks if the context is available (can be started or not)
 boolean isContextDeployed(String context)
          Checks if the context is ready to be called by clients
 void removeWar(String warFile)
          Unregister the given war file
 void run()
          Start the thread for this service.
 void setHttpPortNumber(int httpPortNumber)
          Sets the proxy port number.
 void setRedirectPortNumber(int redirectPortNumber)
          Sets the redirect port number (internal web container port)
 void setWebContainerService(BaseWebContainerService webContainerService)
          Sets the web container service that is linked to this component.
 void startWebContainer()
          Starts the web container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpOnDemandProxy

public HttpOnDemandProxy()
Default constructor.

Method Detail

run

public void run()
Start the thread for this service.

Specified by:
run in interface Runnable

enable

public void enable()
            throws HttpOnDemandProxyException
Start this component.

Throws:
HttpOnDemandProxyException - if start-up failed

disable

public void disable()
             throws HttpOnDemandProxyException
Stop the component

Throws:
HttpOnDemandProxyException - service stopping failed

getHttpPortNumber

public int getHttpPortNumber()
Returns:
the http port number used by the proxy.

setHttpPortNumber

public void setHttpPortNumber(int httpPortNumber)
Sets the proxy port number.

Parameters:
httpPortNumber - the proxy port number

getServerSocket

public ServerSocket getServerSocket()
Returns:
the server socket

setWebContainerService

public void setWebContainerService(BaseWebContainerService webContainerService)
Sets the web container service that is linked to this component.

Parameters:
webContainerService - the service instance

getWebContainerService

public BaseWebContainerService getWebContainerService()
Returns:
the web container service instance.

startWebContainer

public void startWebContainer()
                       throws JWebContainerServiceException
Starts the web container.

Throws:
JWebContainerServiceException - if container is not started

getRedirectPortNumber

public int getRedirectPortNumber()
Returns:
the redirect port number (internal web container port)

setRedirectPortNumber

public void setRedirectPortNumber(int redirectPortNumber)
Sets the redirect port number (internal web container port)

Parameters:
redirectPortNumber - given port number

isAvailableContext

public boolean isAvailableContext(String context)
Checks if the context is available (can be started or not)

Parameters:
context - the name of the context
Returns:
true if context is available

getContextInfo

public ContextInfo getContextInfo(String context)
Parameters:
context - the given context used to get info
Returns:
data on the given context (or null if not found)

isContextDeployed

public boolean isContextDeployed(String context)
Checks if the context is ready to be called by clients

Parameters:
context - the given context name
Returns:
true if it is deployed

addWar

public void addWar(String warFile)
            throws HttpOnDemandProxyException
Called by the deployer if this proxy is enabled. It will store the data for the given war file.

Parameters:
warFile - the given file to deploy
Throws:
HttpOnDemandProxyException - if the file cannot be registered

removeWar

public void removeWar(String warFile)
Unregister the given war file

Parameters:
warFile - the file to undeploy


Copyright © 2010 OW2 Consortium. All Rights Reserved.